Structures and child in [for each child] event

I believe I’m using the most recent version.(5.2.175) Can someone verify this?
I swear I used to be able to build structure name in the for each child event

This works:

But this does nothing and I’m wondering if it’s because of the new way variables are handled.

It also creates an empty structure
image

If I store the label text into a variable it also works

I confirm you have to use VariableString to access the child of a structure.
Or you can write something like Structure[“” + YourVariable] - this is to force the variable to be read as a string.

This will be fixed in the next version.

My issue isn’t the variable part. It’s when I used the label text of a button object. Sorry, I should’ve made that clearer.

It works if I save the text to a variable but not if I use the object expression within the structure brackets.

Indeed it’s not related. Any chance you can try with a previous GDevelop version (get it from GitHub)?

I can’t find any issue with this - any chance you could send me a stripped down version of your project (or the project itself) so I can have a look? Thanks!

I haven’t installed an older version yet but here’s a new simple project that tests the structure name in 4 ways with 4 buttons.

Try me:

Source:

The structure after clicking the 3rd button, a child with the name “” is created.

In practice, each button would have a different text.

1 Like

Super useful! I confirm I can reproduce the problem, your example is really really invaluable here.

This is not due to the new variable syntax it seems - as it’s actually not used here (and I verified it will work in a new bugfix release if we write for Button4 Player[LabelText], as long as you declare LabelText. Don’t try this now because it does not work yet - it’s another bug that is being fixed).

I’ve opened the example with GDevelop 5.2.172 and it also fails with the case Button3.
This is due to the usage of Button3 inside the for each variable. It’s a pain and your workaround (storing it in another variable) is good. It’s not a regression but I’ll try to understand what’s going wrong.

Thanks again - this was super helpful to have a real test case. Should speed up the bugfix.

1 Like

You’re welcome. I appreciate the quick response.