[SOLVED] I can make a continuous music across scenes but the music keeps on repeating eventhough I have unticked the "stop music or sounds on startup" box. So, how do I fix this?

Hello there eveyone. I am but a humble student asking for help from the Gdevelop community. Currently I have a problem where the music that I wanted to play across scenes started to replay when I change the scene eventhough I have unticked the “stop musics/sounds on startup”. To make it easier for you to understand, here is a situational example.

Scene 1(Got music) → Scene 2 (Same music still on-going) → Scene 1 again (Same music still on-going BUT the same new track is restarting again and overlaped with the already played track when I was first at the “Scene 1”).

There’s the problem. So, help me fix it please. Thank you very much everyone! (Sorry for my bad english btw)

Hi Farid_Osem here is my solutions:

  1. You create an external event related to the scenes where there is the music, in this event you set in the conditions “always” and in the action you insert the music
  2. When you click the button or whatever it is (to change the scene), you create a variable and when you change the scene you +1. Then you add an external event where the music where the variable >1 is playing

I hope I helped you, tell me if I wasn’t clear

The engine is doing what you’re telling it to do.

Scene 1 has an event that plays music. You have “stop music/sounds on startup” unchecked, so this music never stops playing. When you come back to Scene 1, the event that plays music is still there, so it starts playing again.

The only thing you really need to do is use the “play a sound on a channel” event action in Scene 1. (never use the “play music” events, those are legacy events and are basically there for compatibility purposes only, you can read more about that here: https://wiki.gdevelop.io/gdevelop5/all-features/audio#choosing_between_sound_or_music_events)

Use a channel # that you aren’t likely to use for anything else, I usually use either 0, or 1000. Then ensure that same event has a condition “A sound is being played on a channel”. Select channel 0 for that condition, then Invert it. You will keep Trigger Once/at the beginning of the scene if your current event has it.

That will make the event behave with the logic "If sound ISN’T playing on Channel 0, play this sound file (your music).

I’m not 100% sure what Thom is recommending above, but the “Always” condition is not needed in any event within GDevelop and should not be used in almost all cases. Having an empty condition box in an event acts the same as always, that condition is also just a legacy condition for compatibility purposes/visuals only.

First of all I wanted to say thanks for eveyone that has helped me here. and I wanted to say that my problem has been solved and I used Silver-Streak’s method and it worked. So, big thanks to you buddy. and thank you as well for the first commentor ThomCannotCode.

1 Like

This was my resolution: