Questions about transitioning between songs

Hello, I’m making a game and I’m new to Unity, FMOD, DAWs and just about everything else I’m working with atm. I’ve watched the music, viking village and survival shooter FMOD tutorials and done a fair amount of searching but still can’t figure out how to do certain things. A major part of my game will be the transitioning between songs/sfx based on the player’s health. The examples I saw in the tutorials seemed to have multiple tracks playing in an event and either looping between different segments or lowering/raising the volume of certain tracks based on the player’s health. First what I’m looking to do is have different songs that play based on the player’s health value and don’t always repeat from the beginning. So, normal state song plays, player gets hurt, normal state song crossfades into hurt state song but saves the position where it faded out, hurt state song plays, player gains health and then hurt state song crossfades back into normal state song starting from where normal state song last faded out etc. Can I do this all in one event or do I need multiple events? How can I save the position of the song when transitioning between these? The logistics of all this is where I’m spinning my wheels a bit. Any advice is greatly appreciated!

P.S. I’ve been looking all over for a complete list of scripting commands for FMOD in Unity but have only found scattered fragments. Is there a complete source I’m missing?

Hi Will,

This is possible through a few different ways.

If you really need the full health music to start off exactly where it left off then you will need to have two separate events. When the conditions for the hurt state are met, you can ramp down the volume of the full health music and pause the event instance, before starting the hurt music. When health has been recovered, you can ramp down the volume of the hurt music then unpause and ramp up the volume of the full health music.

If you just need the music to not start from the beginning, you can have both music instruments and smoothly automate the volumes of the tracks based on a parameter (see the Random Layered music event in the examples project).

Another option is you can have two events which have random offsets (automate the offset on a parameter so you can guarantee starting from the beginning on the first playthrough) so it will not always start from the beginning.

In regards to the Unity documentation, you can use all functions in the low-level and Studio API docs in Unity (using C# or Javascript). There are a few Unity-only helper functions that are all documented. If you are looking for a particular function please let me know.

I hope this has helped.

Thanks,
Richard