|
Java Code - AudioMixer
[Back]
Code:
var Audio : UnityEngine.Audio.AudioMixer;
//Don't forget to Exposed Parameters in the AudioMixer or it will not work
var Sound: float = 1;
//Vol is the name of the exposed parameters and the Sound is the float we made on top
Audio.SetFloat ("Vol", Sound);
//Snapshot
var Snapshot : UnityEngine.Audio.AudioMixerSnapshot[];
//Snapshot script
var Sound : float [];
var Snapshot : UnityEngine.Audio.AudioMixerSnapshot[];
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
//Audio.SetFloat ("Vol", Sound);
Audio.TransitionToSnapshots(Snapshot, Sound, 2.0);
}
}
//Don't forget to Exposed Parameters in the AudioMixer or it will not work
var Sound: float = 1;
//Vol is the name of the exposed parameters and the Sound is the float we made on top
Audio.SetFloat ("Vol", Sound);
//Snapshot
var Snapshot : UnityEngine.Audio.AudioMixerSnapshot[];
//Snapshot script
var Sound : float [];
var Snapshot : UnityEngine.Audio.AudioMixerSnapshot[];
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
//Audio.SetFloat ("Vol", Sound);
Audio.TransitionToSnapshots(Snapshot, Sound, 2.0);
}
}