If I iterate through the children of a transform with a foreach loop, is there any guarantee for the order in which the children are enumerated?
E.g. if I set up a test scene with the following hierarchy:
And then I use a foreach loop to iterate through the children of “Cube”:
foreach(Transform child in this.transform)
Debug.Log(child.name);
What happens is that A B C D is always printed in alphabetical order. Is this a guarantee though? An alphabetical-order traversal isn’t defined in the documentation for Transform.
The reason why I ask is because I am iterating over multiple transform hierarchies that have an identical structure, and it would be nice to know if there is some sort of order guarantee when iterating through children.