I’m creating a string of XML by starting at a root game object and looping through all of its descendants adding the necessary information to the XML string.
The problem I’m having is that the order of the GameObjects does not seem to depend on the order in the hierarchy, but rather the order that they were loaded into the assets folder. Is that correct?
Ideally I would be able to position the GameObjects in the hierarchy and have the loop go through the objects in that order. Is that possible?
I think the individual order of children at the same level is undefined (or well dependant on when they were added to some internal array or list i guess.)
Else they are atleast defiend by parent.
Or maybe this was not at all what you asked. In which case im sorry bout the horrible drawing :?
Thanks for the reply Marc… and that drawing is totally awesome.
We found a solution in the Wiki:
There’s a function here called GetTransforms() which returns the children transforms in a sorted array (using ArrayList.Sort). With some modification we created a function using ArrayList.Sort to sort our game objects in the desired order.