To port over from the native Unity sound engine to FMOD Studio is fairly easy; if you wish to just play an event once you can use:
Or, if you require a bit more control over your audio, you can create the event and play, pause, or stop when required.
event = FMODUnity.RuntimeManager.CreateInstance("path/to/event");
event.start(); // Starts the event
event.setPaused(true); // Pauses the event
event.setPaused(false); // Unpauses the event
event.stop(FMOD_STUDIO_STOP_ALLOWFADEOUT); // Calls a non-immediate stop, allowing sounds still playing (such as reverb tails) to finish off before releasing.
However the example script you are using seems to require a delay before the event is played. This makes it a bit more difficult, but you can try something like this:
// This Reaction is used to play sounds through a given AudioSource.
// Since the AudioSource itself handles delay, this is a Reaction
// rather than an DelayedReaction.
public class AudioReaction : Reaction
public AudioSource audioSource; // The AudioSource to play the clip.
public AudioClip audioClip; // The AudioClip to be played.
public string FMOD_OneShot; // Path to FMOD Studio event being used. Use this for PlayOneShot
public float delay; // How long after React is called before the clip plays.
public int secondsToWait = 10; // Set how long to wait before starting event. Defaults to 10 seconds
yield return new WaitForSeconds(secondsToWait);
FMODUnity.RuntimeManager.PlayOneShot(FMOD_OneShot); // This will play the event once and discard it from memory when finished
protected override void ImmediateReaction()
// Set the AudioSource's clip to the given one and play with the given delay.
audioSource.clip = audioClip;
StartCoroutine(playFMODEvent()); // Waits 10 seconds before playing event
The playFMODEvent function is external to the FMOD integration but will wait 10 seconds (or however long you wish for) before starting the event.
Please see our Unity scripting starting guide for more information: