[Solved] Music pauses on screen pause

The music in my game is working perfectly alright. When i click on pause screen and uses action “pause the scene and starts a new scene”, it is fine and but when i use “stop and go back to previous paused one”, the music stops. Please help.

There is an option in the scene properties, where you can untoggle Stop music/sound on startup. Try doing that

1 Like

Sorry not working…
I found something on GDevelop forums

it is quite confusing but this is the solution of my problem.
Please explain it in a simpler way

From what I understand is,

Offset represents the length of time from the start of the song meaning how far the music/audio has been played. Offset is counted in seconds. It is the same as how videos have a bar showing how long and how far the video has been watched, you can fast forwards or backwards.

When the offset is 0, it means that it is at the start of the music/audio file. And if your song is 10 seconds long, the maximum offset is 10, meaning that it is the end of the audio file.

When you change to another scene and come back, the offset of the music is reset back to 0 (meaning the start of the music/audio file).

So, to fix it, The offset (how far the music has been played from the start) is stored in a variable. Then, when you come back to that scene, the song’s offset is set to the stored variable, making it start from where it stopped.

Hope that I made it clear

:slight_smile:

2 Likes

Thank you very much @Midhil. Really, you explained in a very very simple way. I understood it, I will try the same and will update you too.

Thank you very very much

I saved the offset in a variable


but I could not find how to set the music back to stored variable, Please guide.
Thanks

Atlast i did it…the music files are now being played…
I did it in a bit different way…


When I return back from pause screen, the opacity is increased, it decreases and when it reaches zero, music plays.
Thank you very much once again for your time and help @Midhil

Are you setting the offset? I didn’t see an action in your screenshots. You can set it by using the Music Offset (The name might be a bit different) after you have started playing the music

:slight_smile:

No…i did not use the offset. I did it in a different way. Please check screenshots.

this worked for me, THANK YOU