Due to game mechanics, I need to frequently load save files. However, the moment a scene (game_scene) is loaded, the BGM (AudioStreamPlayer) inside it resets. I’ve been unable to find a way to keep the BGM playing continuously without interruption when loading a save within a single scene.
Currently, I’m using the method of playing BGM via a [Global Control] to prevent the music from being interrupted, but this has introduced new issues: when switching scenes, the [Global Control] cannot update the BGM accordingly
I’ve thought long and hard but haven’t found a good solution, so I’m turning to the Godot team for advice. Any guidance would be greatly appreciated.
That is an issue that needs to be looked into, but I would like to inquire if the following workaround would be temporarily acceptable:
Would saving a variable with the current playback point using “SaveAudioPosition” right before performing the load and then loading that when you load give close enough results, or is the gap in playback too long for you? (Depending on save time and load time, there might be a slight stutter in the playback)
I think that in the future it should be possible. But besides player and enemy status, what else needs to quickly reset? Besides music, what else needs to continue?
If we better understand the structure you need, it’ll be easier to implement or suggest an effective workaround.
Create an Autoload node, which should be able to play music continuously. By using custom script actions, you can control this Autoload node arbitrarily. In theory, this requirement can be met. Also, what does [Global Control] refer to?