I recently tried the AI assistant for the first to write some code. It successfully did what I want, but for some reason, the array variable it created doesn’t appear correctly in the list. The array is listed, “LVL.SAMPE.SAMPLE2”, but in my global variables list, the “LVL” variable is just a number variable. Not an array (or structure) an no children. Despite that, the code still works somehow? I even since made a slight naming change the variables in the event sheet, and it still works all the same, despite still just being shown as a number variable in the global variable list.
You really can’t fix an AI… But the way id assume it works is it talks GDevelop’s actual language (JSON?). Which…isn’t meant to be human readable.
I don’t think you understand what I mean. In the event sheet I see this (some information changed for secrecy sake) array variable, and it works.
![]()
But in the list of global variables, it appears to just show up as a number variable. Non of the children appear to be there.
![]()
And yet… it works. And I’m actually stumped on what to do with this.
attempt recreating its setup in a blank project and see what happens
When you access LVL.Child.Child, GDevelop modifies the variable LVL to a structure of structures. Likewise, if you set it to “Hello World”, it will be modified as a string/text variable.
Note, I’ve recategorised this as just “GDevelop ganeral”
I… Don’t understand.
What do you mean, you don’t understand? GDevelop modifies the datatype of the variable to whatever is was last set to - it doesn’t enforce the datatype it’s originally defined as.
I agree that it doesn’t cause a crash bc gdevelop will usally change a variable’s type but it makes things much easier when variables are defined. The defining of structures isn’t currently mandatory because they can be fluid during runtime but defining them allows the autocomplete to be used for their child names instead of risking making typos when typing them.
The AI should build on the framework of a project and make it easier for people to modify what it created. It should be clean, efficient and easy to understand.
I think it’s probably worth creating a topic on this Keith!