I'm using the Save/Load game function in my game. I use it when a player goes from playing the game and into the menu. I will save the state of the game and when the player comes back i just load it again. All works well for except one thing.
In the menu the player can change settings like turn off sound and reverse controls, with the current system of just saving and loading the settings will go back to saved state so if there are any settings the player changed it will be nulled in the load.
Is there a way to alter global variables of a saved game after loading or maybe inject it somehow into the load command?
Just save after they have made the changes, not sure why you're trying to create a workaround for that.
Develop games in your browser. Powerful, performant & highly capable.
When i go to the menu which is another layout i loose everything in the playing layout. I use save there to have every game pieces at the right place
Well technically you can save settings values separately to local storage and when you load the game on start of layout you can also load the local storage items and compare but it seems unnecessary when you already using save and load. If you insist on using current method then you should have the mute button in the gameplay layout so it can be saved along with the game. You can press a menu button which opens a settings UI but does not change layout.