Variable global music

hello, I have a global variable named music, and a music key in the game menu. When the key is off, I would like the music not to be heard in the first level. When it is on, the music is heard, but I can’t.

Just as a note, if it’s an on/off state, then the most suitable variable to use is a boolean. You can then toggle this instead of multiplying by -1, and just check if it’s true or false.


That sentence doesn’t make sense, but I’m guessing you mean you can’t hear the music in the first level event though you’ve turned it on and played it in the mainMenu? If so, open the level1 scene in the editor, right click on it, select “Open Scene Properties” and uncheck “Stop music and sounds on startup” :

image