A
A
Alexander Fandeev2021-02-23 00:06:50
Unity
Alexander Fandeev, 2021-02-23 00:06:50

How to find the child of a child element?

There are a certain number of elements that are created as children of the previous one. How can I use a script to find the last child element that exists in a hierarchy?

if (curParent == null)
        {
            childOfCube = rootObjInScene.transform.Find("forPlayer(Clone)");

            if (childOfCube != null)
            {
                curParent = childOfCube;
            }
            else curParent = rootObjInScene;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question