I create a bunch of audio components programmatically and I would like to set the number of times they loop when they play. I haven’t found a way to achieve that in C++ and the only solutions I could find use the blueprint system.
Did I miss something in the documentation? Maybe it is a feature that needs to be implemented manually.
This should be a property on the Sound Waves themselves, not on the AudioComponent. If you look in the starter content at Starter_Music01 - Generic, it is a looping sound.
Does it mean that the property is set per sound wave? I would like to be able to have to audio components referencing the same asset but with different looping settings.
It seems that way. If you want it to loop manually, you can always tie into the OnAudioFinished events to restart the sound. It’s probably easier to just make two versions of the soundwave though.
Thanks, for your help. I will test both solutions and see what works for me.
Is there a better solution (In BP or C++) for this?
hello am from google, athousand years in the future. in UE5, To do in BP (and prob in c++),
- you need to make your wave into a soundque OR metasound
- make the sound que look like this:
its the same node, but in the NODE looping is checked
the wave file has looping UNCHECKED
- Take a look at this BP for implementation idea:
and thats it!
in c++ cast your audio component to
IAudioParameterControllerInterface then just call
->SetBoolParameter(TEXT("Loop"), true) etc etc