For each Child Variable event [Use Global Variables too!]

I found this new feature, and thought that it might be useful for my Event Structure.
I was hoping that i do not need to loop thru all children, if i can repeat for each child.
Turns out i cannot, a, because it doesn’t exactly work how i was expecting, but secondly, and more importantly i cannot use Global Variables.
i am aware that i can bus around data from Global to local and back, but that essentially almost doubles the memory usage for no good reason.

so yeah, Global variables too, please :slight_smile:


It is only for scene variable i guess.

Yes, global variables should be possible. I’ll look into it after the PR I’m currently working on. Though object variables might be more difficult.


I just discovered that “For each child” events can only loop over Scene variables:

It’d be great if they could additionally loop over Global variables and Object variables.

1 Like

Correct. This is intended and mentioned in the documentation. For each child variable event - GDevelop documentation

@Silver-Streak It doesn’t actually mention that you can only loop over Scene variables. It says you can loop over structure variables (or arrays), and it says that the key and value of each child variable are saved as Scene variables, but there’s no mention of, or explanation why, only Scene variables can be looped over…

Hmm…there was a restructure on this page done at some point, as it used to have a Tip/note above the section. Might have got lost with the migration from the wiki to the new mkdocs site.

Regardless of the cause, you’re definitely correct, apologies for the confusion. Either way it is expected behavior.

I’ll work on updating it on the documentation page.

Edit: As a heads up, you can also review the variable type of event conditions, actions, or special event type by the icon preceeding it:

The icon to the left of the variable selector is the scene variable icon.
Globals: image
Object Variables (in actuality Instance Variables): image
Scene Variables: image

All variables are event condition/action specific, so the icons are there to help ensure you’re calling what you expect.


I would like to use it with global variables too… And for object variables you could do object picking and then inserting it as a sub-event

1 Like

Agreed. Global, scene and object variables should all have the same events, actions, conditions and expressions.

Feel free to vote on this feature request on Trello :slight_smile: