Global Variables

Hi everyone!

Not sure it is the best place or best way to ask, but, I was wondering if there was a problem in having a lot of global variables. Like dozens of them. Hundreds maybe…(?) I find myself relying on that a lot. I do not have any exemple or situation. Just wondering if it was something you wanted to avoid for some reason a noob would not guess. I know that some situation might call for that, but I was wondering if it could cause problem and why.

Thanks a lot!

I tried a million variables, it seemed to work but GDevelop crashed when I tried to open the debugger. :sweat_smile:
I tried 100 000, it works but it takes 4GB ram and some loading time to see them in the debugger.
The game itself doesn’t lag, just trying to display them all takes time and memory :blush:
To answer: the number of variables don’t matter, it’s what you do with them :wink:

Fair enough.
I doubted there was any problem, but sometime you just don’t know! But I have no plan on stocking millions of them so I will be OK. :stuck_out_tongue:
Would be sweet if the editor allowed any kind of sorting methods when you edit them.
Do their order in the list matters?

No, the order doesn’t matter.
The variable editor lacks many things :slight_smile:

Well there is one… I will not complain!


Can I ask what type of game was that? This makes me scared.

for my game, i will have about 300 global variables, each with about 30 children. looks like i will be ok based on above comments.

It was just for testing :grin: I used repeat loops to create variables :wink:

1 Like