For Each Child variables: should references be used? #2572
arthuro555
started this conversation in
Enhancement ideas (and their technical discussions)
Replies: 2 comments 3 replies
-
I can see both sides of this, but you might want to give more detail about what you mean by references so more people can contribute. Also, doesn't the Raycast conditions use references, even if its just storing them as variables temporarily? |
Beta Was this translation helpful? Give feedback.
3 replies
-
I don't think we really should:
More generally, a deep copy should rather be a conscious choice, done with the action to do it. But by default, it should not be done. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As of now, the implementation of the For Each Child variables is not very cool: It uses references for Collections, which is confusing, since the concept of references is nowhere else in GDevelop and not there for Primitives variables. We should probably replace it with the new deep copying method added with the Arrays and Booleans types, but now I am thinking: Shouldn't we use references there?
I think for other things, users would be confused, but when iterating over the children, in my mind at least, I am still accessing a child of the main variable, not a copy of it.
Beta Was this translation helpful? Give feedback.
All reactions