+1 vote

Hi all. I'm teaching myself about programming. I'm trying to anticipate problems before they occur. If I call Object.get_children(), can I depend on that array looking the same to the computer across all platforms? Coming from Python, I know not all data structures have fixed order - dictionaries only got it fairly recently, for example, and I'm still not sure if their order is "dependable," (OS quirks mess with it IIRC).
I ask this not because I am experiencing a bug related to the issue, but since I don't want to make false assumptions about how order is maintained. If the question is too vague to understand, please let me know and I will attempt to revise, but my technical skills are still underdeveloped, so my descriptions may fail me.

asked Mar 18 in Engine by DDoop (395 points)
retagged Mar 19 by DDoop

very nice and informative for me.

For the record, Godot's Dictionary class preserves order since 3.0, even though it may not be apparent when printing them.

1 Answer

+2 votes
Best answer

Yes, child order is fixed, and get_children() returns an array of the children in order. See also get_child() and get_position_in_parent().

answered Mar 18 by kidscancode (17,168 points)
selected Mar 18 by DDoop
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.