unity cycle children 1

unity cycle children

for(int i = 0; i < gameobject.transform.GetChildCount(); i++)
   Transform Children = gameobject.transform.GetChild(i);

Here is what the above code is Doing:
1. We're looping through all the children of the gameobject.
2. We're getting the transform of each child.
3. We're storing the transform of each child in a variable called Children.

Now, we can access the transform of each child by using the variable Children.

Similar Posts