+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.

in Engine by (747 points)
retagged by

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().

by (22,071 points)
selected by
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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.