FindChild not working - Unity 5.5 2D
I've been following along with the Brackeys tutorial of how to shoot to the mouse position from a specific point on you character. I've followed his exact script however I keep getting an error saying that the child of my gameobject cannot be accessed. I've seen in the YouTube comments some other people having this problem however I cannot find an answer for it. Here's the code that keeps going wrong:
void Awake () { fireFromHere = transform.FindChild("firePoint"); if (fireFromHere == null) { Debug.LogError ("No firepoint"); } }
I'm sure that it is just something that has been changed as Unity gets new versions released however I cannot for the life of me figure out how to fix this.
I have also seen someone fix this on their own by putting (" 'gameObject'/'child' ") however this just causes more problems for me.
Some help would be very much appreciated.
Your answer
Follow this Question
Related Questions
2D topdown projectiles movement 0 Answers
Accesing The Script Under GameObject 0 Answers
Shooting mechanic - can't shoot left and right,2D shooting mechanic - can't shoot lift and right 0 Answers
Rigidbody2D figits when pushed against an object. 0 Answers
Return Object to Original Position after it's Disabled 1 Answer