Continuously playback of music during map changes without persistence level

Hi!

I would like to have continuously playback of music during map changes, menu to in-game. I know you can create a persistence level to achieve this but since I also want to support custom user made maps I can’t add levels as sub-levels. That solution isn’t just flexible enough. The users must be able to add the maps themselves without recompiling the game or changing any global map that potentially could break maps they added earlier or similar. I tried to steam levels that wasn’t added as a sub-level without any success.

I find the way of achieving continuously playback kinda awkward at the moment. It doesn’t make sense for me to couple 20+ maps in one map just to being able to play background music seamlessly, hopefully there is a solution to this which would explain that.

So is there anyway to achieve continuously playback of music in unreal engine if you have those demands or must I limit the music to only the main menu?

Thanks!

same problem here:

link text

I am very interested in solving it without persistent levels.

Thanks for letting me know. I will check that question also. Regarding to its answer, maybe I should post this as a feature request instead.

Totally agree with you. Make it a feature request.

Here it is.

Hey guys,

We unfortunately do not support continuous sound play through a level load at the moment. It’s probably something that can be easily supported, but would be a feature request at this point. The audio engine shuts all sounds down when unloading a level.

I will go ahead and enter a feature request for this issue. Thank you for taking the time to enter a request and let us know if you have any other questions or comments.

UE-16451

Cheers,

Here is the Feature Request ticket number UE-16451

Update: There actually is a bIgnoreForFlushing flag on AudioComponents and ActiveSounds that is intended to allow sounds to persist across levels.

I’ll try and tell you something.

That sounds great, thanks!

I have used bIgnoreForFlushing myself and sound does persist across levels now (however it seems to cut in/out a lot when server travelling). I have come across an issue with this (currently using 4.5), where when I close the game and the engine begins to free resources, the game crashes on tearing down the audio because the sounds has not been removed from the source list correctly when it is not set to flush.

is this only something that is available to C++ or can this be done with blueprints also cause it seems like it cannot?

You should be able to expose this variable within the properties of the USoundComponent within blueprints.

Hey,

I cant seem to find a way of exposing bIgnoreForFlushing anywhere in blueprints, I’m using UE4.9 the link you sent didn’t really explain anything at all to me. is there a more detailed explanation of how to expose this variable?

ive searched and searched and this page is the closest the internet has to an answer.

thanks in advance

So I just did some digging and the variable is not actually exposed within blueprints or the editor and can only be set within code. You will need to set this option for the sounds you are currently playing before loading a level, and then set bIgnoreForFlushing to true. I have updated the bug report to reflect the necessary changes.

You can also head to our recently announced Public Bug Tracker and vote for this issue. Let me know if you have further questions or need additional assistance.

Cheers,

Yeah, I agree

Hello,
I extended the AudioComponent adding getter and setter to expose in blueprints bIgnoreForFlushing, although when I set it to true and then I open a new level the sound is interrupted.
When you wrote that the option has to be set also on the sounds what do you mean?

I had the same problem with both 4.11 and 4.13 versions of the engine.

Thank you in advance

Have you tried it in code alone instead of exposing it within blueprints and then setting the boolean?

Also, if you are calling these sounds to ignore flushing when loading a level, be sure it is not within the current level blueprint or it is expected the sound would be interrupted.

You mentioned, ‘the sound is interrupted’ but can you be more specific in regards to how it is interrupted and if it continues to play after the fact?

I had the same problem with both 4.11 and 4.13 versions of the engine.

Does this mean you tried it within 4.12 and it worked, or that you only tested on those two engine versions and it occurs in both?

Thank you,

Hello I created a C++ Actor and played the sound through the actor.
Here’s the code:

.h

#include "GameFramework/Actor.h"
#include "AmbientSoundPlayer.generated.h"

UCLASS()
class UNREAL_DONTMAKELOVE_API AAmbientSoundPlayer : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AAmbientSoundPlayer();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	// Called every frame
	virtual void Tick( float DeltaSeconds ) override;

	UPROPERTY(VisibleAnywhere, Category = "Audio Component")
		UAudioComponent* AudioComp;

	
	
};

.cpp

AAmbientSoundPlayer::AAmbientSoundPlayer()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = false;

	AudioComp = CreateDefaultSubobject<UAudioComponent>(TEXT("Sound Component"));
	
	if (AudioComp)
	{
		AudioComp->bAutoActivate = false; // with this true the sounds play at spawn (game starts)
	}
}

// Called when the game starts or when spawned
void AAmbientSoundPlayer::BeginPlay()
{
	Super::BeginPlay();

	AudioComp->bIgnoreForFlushing = 1;

	AudioComp->Play();
	
}

can you be more specific in regards to how it is interrupted and if it continues to play after the fact?

The sound just stops and doesn’t continue.

Does this mean you tried it within 4.12 and it worked, or that you only tested on those two engine versions and it occurs in both?

I tested only 4.11 and 4.13.

I’m not an expert of C++, so bear with me if I’m doing something wrong.

Thank you in advance,

So I did some more investigating, and this is not going to be an easy task to code. The current system requires native code and is a bit tricky and requires almost working around the system.

There is work that could be done here to make it more usable. This is known by our developers and we are attempting to find the proper implementation for this functionality. This is all the information I have in regards to the issue, and when an update is made to UE-16451 this post will be notified.

Thank you,