I migrated my game done with Unreal Engine Early Access 2 to Unreal Engine 5.
I now have a major issue with the ‘‘Set integer parameter’’ using a Switch in a SoundCue.
I have a SoundCue that manages the music playing when I travel from a level/area to another. I used to set my ‘Level’ Parameter as an Integer in my ‘MASTER_MUSIC_SOUNDCUE’.
I used a switch in my soundcue to switch from one track to the other. Now that I migrated to Unreal Engine 5, the switch works BUT ONLY ONCE. Once I set my Integer parameter once, I cannot change it again.
The same issue is affecting my Stepping sounds for surfaces. When I set the Integer parameter in my soundcue to ‘Swimming sound’, it won’t switch back when I walk on the ground again.
I tried everything. It’s weird that I am able to change my Integer Parameter a first time when the switch is ‘Unset’ but I cannot switch it afterward.
I had the same problem, and I also have been trying everything to fix it (started at 11:40pm thinking it would be an easy thing to fix but now is 3:12am )
I’m glad to tell you I found a workaround! For now, I’ll call it a workaround because the old way should be able to work unless I may be misunderstanding how the audio system works, which could be possible because I haven’t researched it as much as I would like.
The same issue is affecting my Stepping sounds for surfaces. When I set the Integer parameter in my soundcue to ‘Swimming sound’, it won’t switch back when I walk on the ground again.
So the code that used to work for me is this one. Which played different footstep sounds depending on the surface. That FootstepComponentRef is an Audio Component inside my character, where I can change that Integer value to update the type of sound that should be played
Looking around the audio component inside my character, I found this little category, that I don’t remember if I saw it before or not, called Default Parameter. I didn’t know if it worked correctly, so to test it I added my parameter name and value and decided to disconnect all the code the changed the parameter value.
This little change seemed to work, and if I manually changed the value before playing in the editor, the sound seemed to change.
Now, thinking logically, if it’s an array I can probably change the value in runtime and maybe UE5 will like this new approach, so I changed my previous code to this:
Duuude !!!
You’re my hero!
Thank you so much for your fast and full fledged answer!!! It all seems to work now.
I’ve also been playing with the new ‘Default Parameters’ section but didn’t managed to make it work.
I find it odd that we have to use this workaround. We now need to define the name as well as the index of the parameter to change it when we used to only need a ‘name’ to find the parameter. I hope Unreal will provide documentation to explain why it works that way now… or fix it the old way of doing things
Nevertheless, thank you very much! And great work for finding a solution to this issue! I spent a lot of time too trying to figure it out xD
Hmm i have the same problem, right now I’m changing a boolean parameter while the sound cue is already playing. That worked until I upgraded yesterday and sadly your solution doesn’t work for me. It’s not changing while already playing. I can change it manually before starting but not in play. I hope the old way of doing this will be fixed soon.
Same thing here. I can not set audio parameters or update it in real time. If anything else, you could use a switch case and point each case to a separate sound cue that doesn’t take any parameters. But more work. I hope this gets fixed and not ignored.
Same over here. I had a vehicle with the engine sound modified in real time by the engine RPM, through a float sound parameter. In tthe UE5 preview version worked well, after the update it doesn’t work.
This doesn’t work neither in the Vehicle template project, where the blue buggy always sound like it’s iddling despite the RPM or speed.
@Ramboozled’s solution worked for me as well, but for my situation I also had to add a short delay and reset the parameters after it played for some reason. Just wanted to add this note
One more thing to note about the workaround is that you can only change the default parameters and have them take effect if the sound isn’t already playing so this unfortunately doesn’t play well with a more dynamic sound like an engine sound and an RPM parameter.
It sounds pretty bad still because of the constant cut out but I used this logic to at least get some better sound while I wait for a fix :
//...
const FName RPMName(TEXT("RPM"));
// ...
float Rpm = Movement->GetEngineRotationSpeed();
UE_LOG(LogGameVehicle, VeryVerbose, TEXT("%s: Setting Engine Sound %s to %f"), *GetName(), *RPMName.ToString(), Rpm);
// FIXME: Due to https://forums.unrealengine.com/t/unreal-engine-5-problem-with-sound-cue-and-set-parameter-switch/514798/2
// To be fixed in UE5.0.2 - below is a workaround for
// tracked in https://issues.unrealengine.com/issue/UE-148618
// EngineSounds->SetFloatParameter(RPMName, Rpm);
int32 RpmParameterIndex = FindRPMDefaultParameter();
check(RpmParameterIndex != INDEX_NONE);
float CurrentTime = GetWorld()->GetTimeSeconds();
if (CurrentTime - LastSoundUpdateTime >= 0.25f && FMath::Abs(Rpm - LastRpm) >= 1000.0f)
{
EngineSounds->Stop();
EngineSounds->DefaultParameters[RpmParameterIndex] = FAudioParameter{ RPMName, Rpm };
LastSoundUpdateTime = CurrentTime;
LastRpm = Rpm;
EngineSounds->Play();
}
I am working on 4.27 Plus and it is not working but adding the audio component inside my Blueprint worked. Interesting that this is working on regular launcher 4.27