I’m currently trying to have it so that the audio component on my blueprint object plays at a level proportional to how fast it is going. But I’m not sure how to do this, I’m guessing because I’m not using the volume setting functions correctly.
Here is how I’m currently trying to do it (this is inside the TickComponent):
You can ignore the weird function I’m using to get the multiplier from the speed if you want. It’s basically just having the multiplier be 1 if the speed passes a certain threshold and 0 otherwise. But also feel free to give me a better way of scaling the multiplier.
if (!rollingSound->IsPlaying())
{
rollingSound->Play();
}
Ok it’s because I wasn’t doing this Play(), I had a Play() in the function previously, but it was either playing nonstop overlapping audio when I had “Play Multiple Instances” allowed, or playing nothing when it wasn’t allowed.
So follow up question, why exactly does this happen? In my brain I understand why the overlapping audio happens when “Play Multiple Instances” is allowed, but why does it play nothing when it’s not allowed? (combined with when I didn’t have that snippet above).
If the volume is zero, it won’t play anything when multiple instances aren’t allowed (not sure what it does when they are allowed). So perhaps that’s why it doesn’t play?
If you want to allow it to play even at a volume of zero, you have to turn on virtualization. In newer version of UE, it’s the “Virtualization Mode”. Set it to “Play when Silent”. You set this on the sound wave or sound cue directly.
Or you can just make sure to never set the volume to exactly zero.