How not to stop the music when game is paused?

In my game, when the player character dies, I handle the game over screen with the Set Game Paused node so as to stop all the things from happening and show them the endgame blueprint. I now know of all the limitations this puts on me and that it wasn’t the best design idea, which I wasn’t aware of back when developing most of the game, but since all is now scripted with this behaviour in mind, I’d rather not change it anymore. So the problem is, I’d like the background music to not stop playing when game over happens - which it now does because of the pausing behaviour. I’d just like to maybe lower the volume or pitch but not abruptly cut the music altogether as if something broke.

How would I go about doing that? I don’t see any options for this. How do I not stop the music on pause, then?

I don’t know if there’s an ‘official’ way of doing this, if you started the music from a widget, it wouldn’t pause when you went to the menu.

You can just use an empty widget ( no graphical element ), to play the music…

Thank you. In the end I just marked the music as UISound in its properties pane and now it keeps playing regardless of it’s paused or not.

2 Likes

For a more “official” approach, you could try putting the sound on an actor that is 'bTickableWhenPaused."

I think it’s accessible in details, but if not here’s the node for it:

Very clever workaround, I like it!

Go to the audio component is playing your sound cue.

Flag isUISound

tested on UE5

4 Likes

I checked UI Sound.
But now the problem is, that the Background Music is playing all the time, even when i´m working in the Unreal Editor, without actually testplaying the game.

This is fine. You can reduce the real time audio volume.

I’ve got the music playing from my game mode, and setting the game mode to tick when paused didn’t make a difference. Same with the level blueprint for the menu map. I don’t want to set my music to UI either. Any other ideas?

Oh, actualy, in my case my music is an audio component inside my game mode, and my main menu uses a child bp of the game mode. From there I can get the music component and set its UI Sound to true and this works. Now it’s specific to my menu music only.

I thought this would affect the volume control of my audio cue as I want it to be set to music so I can adjust the music volume in my settings. I am pleased to say that setting the audio component to UI Sound does not affect the SoundClass, so it still responds to my music volume setting.

1 Like