Continuous Music through Level Change and Restart

This is the best answer; I had to unpack it a little to understand it for Unreal 5.3:

  1. Import your soundtracks as a audio wave files and stash in your content (I use an Audio folder).

  2. Create a Sound Cues. In each one set the Class to Music, and drop in the soundtrack WAV, making to to make it loop

  3. Create a blueprint of type Game Instance, e.g. BP_GameInstance

  1. Change the game instance class: Project Settings > Maps & Modes > search for “game instance” > change to your BP_GameInstance

  2. Edit the BP_GameInstance blueprint

image

5b) Create variables to hold the currently playing sound component, and the last sound cue. Bonus: add a variable for the audioFadeTime.

5c) I went with a Custom Event called “PlaySoundtrack”. It takes a “new sound cue”. If the current playing sound is the same as what was last playing, it does nothing. Otherwise it fades out the current soundtrack and then spawns a new soundtrack.

  1. I made a global function (Blueprint Function Library) that takes a Sound Cue and calls the BP_GameInstance custom event to play the cue

image

  1. Finally, on each level/map, it’s as easy as going to the event graph and on Event BeginPlay you can call the global PlaySoundtrack function. That way whatever level you play it will play the right soundtrack, but it won’t change it if it’s the same song.
1 Like