Restart Game not Quit. Reset all global variables

Hi Folks,
is there an easy way to do the following?

Restart Game not Quit. Reset all global variables (without having to name each global variable to be reset) ?

thanks

It’s is not possible right now, AFAIK :frowning:

But the next version of GD will have some actions to copy/load any structure variable into/from JSON, so you will be able to do the following:

  • First you have to put all the global variables as childs, inside a global variable structure called Globals (for example).
  • At the beginning of the game, convert the structure Globals (with all the default variables inside) into a JSON string, and save it into another global variable GlobalsDefaultString.
  • Everytime you want to reset the global variables, load the JSON string stored in GlobalsDefaultString into the structure Globals.
    It won’t work for variables created after the defaults string is saved, anyway the release date for a new version is unknown…

Yeah not really possible right now, I switched almost everything to scene variables in order to at least have a way to do this by restarting the scene. Obviously that only works if you work with few or one scene only.

Thanks for the replies folks.

Perhaps Restart Game would be a good Action to add to GDevelop.

Yep, I’d love to have that too.