How to randomize Game Music on Gameplay?

Hi there, I’m pretty new to the whole FMOD API, but I was wondering if someone could help me out.

I have a gameplay music 2D event, but I want it to randomly pick through the songs every time the scene is reloaded. So the song loaded in the scene should loop.

Thanks.
Let me know if I’m unclear so I can explain it a little better.

If you have a multi instrument with a playlist set to shuffle, setting the playlist and each entry to loop infinitely will randomly choose a playlist entry and loop it indefinitely. If you create & play the event instance when the scene loads and stop & release the event instance when the scene is unloaded, this should give you the result you want.

You can also look into using a parameter sheet to control which track is played by passing a value into the parameter. This gives you greater control over which track exactly gets played.

1 Like