I have a problem in adjusting the volume of my Audio Listener.
When I tried to drag the thumb of the horizontal slider that I had created, the volume of the background music is still remain the same which was set as 10.
Is there anything that I should modify in my script?
Here is the script:
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;
}
}