How can I check to see if a GameObject is a Child of another GameObject
So I need to check to see if a GameObject I have has another GameObject as its parent, my current code is: public GameObject fireBallBook; public GameObject inventorySpace; // Update is called once per frame void Update() { if(inventorySpace.transform.parent == fireBallBook.transform){ if(Input.GetAxisRaw("Horizontal") < 0) {instantiate object here}}
both GameObject have rect transforms and i was wondering if that was causing the problems. You cant throw fireballs if you have the book, thats good, but it doesn't work either if you have the book to.
Your answer
Follow this Question
Related Questions
¿Why wont child move with parent? 0 Answers
how add child to multi gameobject 0 Answers
How do I stop a child from taking the parent's tag? 1 Answer
Make Parent Follow Child and Vice Versa? 1 Answer
Parenting over network 0 Answers