I’m currently trying to fix a feature in my game that has to turn off the music when the player unchecks the button and then save it so when the scene is restarted the music won’t start playing.
But somehow the global varible that defines if the music will start at the beginning of the scene or not gets resetted every time the current scene is restarted or a new scene is opened. Even though i save and load it:
Hi you’re not doing anything wrong. And you’re not going crazy.
What’s happening is that, even if your boolean is true from loading saved events or from a previous scene, as soon as your new or reset scene is done loading, your scene sees that the checkbox is (by default) “checked” and so it must set the Musicoff bool to false because events tell it to. An extra step is needed in your beginning of scene events, so that if the Musicoff is True in the beginning, your scene will “uncheck” this box so that it won’t override Musicoff as soon as the scene plays.
This example shows how a way to do it similar what you are doing now:
Edit Just for clarity. I randomly set the volume to 0 in the beginning of scene events. This doesn’t matter. You can set it to 5, 40, 100, it doesn’t matter because the actual volume is controlled in your event.