For instance, if I wanted to pause the game and create a menu on its own layout, how would I save the state of the first one (enemy positions, player position, variables, etc)? Thanks in advance.
Develop games in your browser. Powerful, performant & highly capable.
just use the save and load option option .
before you leave the game layout to go to the pause layout add a save and when you exit the pause layout and go the game layout again " on start of layout load that previous save". -this goes to the game layout-
For pausing a game you can set timescale to 0
To create a pause menu, create a layout in a specific layer. Set the visibility of that layer to on, when the game is paused.
just use the save and load option option . before you leave the game layout to go to the pause layout add a save and when you exit the pause layout and go the game layout again " on start of layout load that previous save". -this goes to the game layout-
I thought of this, but what if you alter some global variables while the game is paused (e.g. change some game settings)? Won't they be lost if you attempt to reload the save file?
Then you should follow the minion's advice