Unity Cross-fade EventInstance with another event

Is it possible in Unity to have an ongoing EventInstance and somehow cross-fade it to a different event programmatically? We’re trying to figure out how we can have a totally separate track as a single event replace a dynamic ongoing piece.

Desired workflow as follows:

  1. EventInstance of dynamic track
  2. Trigger replacement of dynamic track with a different dynamic track
  3. Cross-fade the tracks

NOTE: I apologize if I’m not using the proper FMOD terminology. I’m a programmer who generally doesn’t work with sound too much, so this is all new to me.

Off the top of my head there are three ways you could do this:

  1. Have separate events in the tool, separate instances at runtime, start and stop them in code, cross-fade in code using EventInstance.setVolume()

  2. Have separate events in the tool with a fade-in fade-out (AHDSR) on the master volume, separate instances at runtime, start and stop them in code. Disadvantage is fade-in is always present even when you might not want a cross fade.

  3. Have the events as subevents of a master event triggered on a parameter. Start the master event once, change the parameter value in code. Put an AHDSR on the event instrument to handle cross fading. Advantage is there is only one event instance to keep track of.

1 Like