FadeTest
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FadeTest : MonoBehaviour {
FMOD.Studio.EventInstance Sound;
void Start () {
Sound = FMODUnity.RuntimeManager.CreateInstance("event:/Test 4");
}
void Update ()
{
FMODUnity.RuntimeManager.AttachInstanceToGameObject(Sound, GetComponent<Transform>(), GetComponent<Rigidbody>());
}
void OnTriggerEnter()
{
Sound.start();
}
void OnTriggerExit()
{
Sound.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
//Sound.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
}
}
using System.Collections;
Back
using System.Collections.Generic;
using UnityEngine;
public class FadeTest : MonoBehaviour {
FMOD.Studio.EventInstance Sound;
void Start () {
Sound = FMODUnity.RuntimeManager.CreateInstance("event:/Test 4");
}
void Update ()
{
FMODUnity.RuntimeManager.AttachInstanceToGameObject(Sound, GetComponent<Transform>(), GetComponent<Rigidbody>());
}
void OnTriggerEnter()
{
Sound.start();
}
void OnTriggerExit()
{
//Sound.stop(FMOD.Studio.STOP_MODE.ALLOWFADEOUT);
Sound.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
}
}