/// <summary> /// Play ambience in FMOD with defined Fade Time. /// </summary> /// <param name="ambienceEvent"></param> /// <param name="fadeTime"></param> public void PlayAmbience(string ambienceEvent, float fadeTime) { currentAmbienceEvent = ambienceEvent; ambience = FMODUnity.RuntimeManager.CreateInstance(ambienceEvent); ambience.setParameterByName("Fade In", fadeTime); if (FMODUtils.IsInstance3D(ambience)) { ambience.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(Camera.main.transform)); } ambience.start(); }
/// <summary> /// Play music in FMOD with defined Fade Time. /// </summary> /// <param name="musicEvent"></param> /// <param name="fadeTime"></param> public void PlayMusic(string musicEvent, float fadeTime) { currentMusicEvent = musicEvent; music = FMODUnity.RuntimeManager.CreateInstance(musicEvent); music.setParameterByName("Fade In", fadeTime); if (FMODUtils.IsInstance3D(music)) { music.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(Camera.main.transform)); } music.start(); }