Answers for "unity how to reference child object"

C#
6

unity access child

// To acces a child of a gameObject use the combination below
parentGameObject.transform.GetChild(0).gameObject
Posted by: Guest on February-20-2020
2

how to reference a child gameobject unity

Transform[] transforms = this.GetComponentsInChildren<Transform>();
 
 foreach(Transform t in transforms)
 {
     if (t.gameObject.name == "Child")
     {
         Debug.Log ("Found " + t);
     }
 }
Posted by: Guest on July-28-2021

Code answers related to "unity how to reference child object"

C# Answers by Framework

Browse Popular Code Answers by Language