- Home /
The question is answered, right answer was accepted
How is order of children decided?
I have an empty game object with 3 children 2 empties and 1 mesh. I thought the order was alphabetical, but when I have the names as A,B,C and it will show me the order is C,B,A. They are listed in the hierarchy in proper order, but when I use GetChild(0) they give me what should be GetChild(2). Anyone know why this might be?
Answer by tomekkie2 · Aug 15, 2012 at 08:50 PM
They are listed upon the order of creation.
yeah to see the order switch the inspector to Debug(by clicking on little parallel lines on top right of the inspector window) all children are sorted by "Instance ID value".
Answer by ScroodgeM · Aug 15, 2012 at 09:06 PM
in editor children are sorted, but internally not.
use
http://docs.unity3d.com/Documentation/ScriptReference/GameObject.Find.html
to get children by name
Follow this Question
Related Questions
How to move the parent object to a child of one of its children? 2 Answers
check if children are visible, if not destroy parent? 1 Answer
How to find an object in children 1 Answer
Parent GameObject dosen't move anymore if the children have a rigidbody 2 Answers
Why does this function still reference a destroyed child? 1 Answer