I just created another Audio Source and called it MasterVolume, then i linked its values to the Audio Listener. Then use your slider to control the MasterVolume.
using UnityEngine;
using System.Collections;
public class AudioControls : MonoBehaviour {
public GameObject masterVolume;
private float aSliderValue = 1;
void Update ()
{
aSliderValue = masterVolume.audio.volume;
AudioListener.volume = aSliderValue;
}
}
↧