Answers for "getting a component in a child object unity"

C#
3

how to reference a child object unity

private void Start()
    {
        parentObject = GameObject.Find("Parent");// The name of the parent object
        childObject = parentObject.transform.GetChild(0).gameObject; // the parent index (starting from 0)
    }
Posted by: Guest on July-03-2020
2

Unity find component from child object

//Returns the component of Type type in the GameObject or 
//any of its children using depth first search.

//A component is returned only if it is found on an active GameObject.

Transform transform = GetComponentInChildren<Transform>();
Posted by: Guest on March-10-2021

Code answers related to "getting a component in a child object unity"

C# Answers by Framework

Browse Popular Code Answers by Language