Can someone please tell me now to change a parameter overtime in unity C# script. I’ve been trying everything I can think of and can’t figure out how to do it. I can get the parameter to jump to different points, but I can’t get it to be a gradual change. Like fade from 1 type of music to another. I think I need to use the getParameter or something. All help is appreciated.
Here is my code:
using UnityEngine;
using System.Collections;
public class soundManager : MonoBehaviour {
FMOD_StudioSystem soundSystem;
public FMODAsset asset;
FMOD.Studio.EventInstance evt;
//FMOD.Studio.ParameterInstance pMusic;
// Use this for initialization
void Start ()
{
soundSystem=FMOD_StudioSystem.instance;
evt = FMOD_StudioSystem.instance.GetEvent(asset.id);
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown ("p"))
{
evt.start();
}
//change an events parameters based on a key input:
if (Input.GetKeyDown ("o"))
{
evt.setParameterValue ("music", 1.0F)
}
if (Input.GetKeyDown ("i")) {
evt.setParameterValue ("music", 0.0F);
}
}