Question by
psraganvesh · Aug 17, 2016 at 06:44 AM ·
raycastnullreferenceexceptionraycastingraycasthitnull reference exception
NullReferenceException while raycasting?
I dont know why but when the player is free falling i'm getting a nullReferenceException on the line 33, and yes every gameobject in the scene has a child.
Comment
on line 33 you are referring to it's parent that means if hit.transform is top level object in hierarchy then hit.transform.parent will be null.
use Debug.Log("the object", hit.transform);
when you click the log in console it will highlight object in hierarchy with hit.transform and you can check if it has parent or not.