Download

need help, some problem with looping sound

Hi, I have been trying to implement a Jet Fighter game on UE 4.14 I ran into a weird problem about looping sound.

I connect my .wav file of the sound to a sound cue and set it looping, then I add that sound cue reference to an audio component and attached it to my pawn using C++. Then the problem comes. After packaging the game, the looping sound I attached will always play even I didn’t spawn my pawn(e.g. I have a menu level and I just set the pawn to a default pawn which does not have the audio component, but the sound still plays) And this only exists in the packaged game, when running the game in selected viewport or new editor window, everything is fine.

here is my code:

 // Get Engine Sound Ref
 static ConstructorHelpers::FObjectFinder<USoundCue> EngineSoundRef(
     TEXT("SoundCue'/Game/Assets/SFX/EngineSound/MiG-21_ENG.MiG-21_ENG'")
 );
 EngineSoundComponent = CreateDefaultSubobject<UAudioComponent>(TEXT("EngineSoundObj"));
 EngineSoundComponent->SetupAttachment(RootComponent);
 
 // looping sound problem not solved........
 // checking looping sound problem
 if (EngineSoundRef.Succeeded()) {
     //EngineSound->VolumeMultiplier = .3f;
     EngineSoundComponent->SetSound(EngineSoundRef.Object);
     EngineSoundComponent->SetVolumeMultiplier(.5f);
     EngineSoundComponent->bStopWhenOwnerDestroyed = true;
     EngineSoundComponent->Play();
 } 

Everything used to be fine on 4.14.0, but after upgraded to 4.14.3, the problem comes.

Could anyone help? Thanks