Sound Controller

Hello frndz…

How can I put sound volume control in my unity3d game.
as I am new in Unity3D please help me!!!

The sound volume in Unity is controlled via the Audio Listeners. The normal volume that the Audio Listeners are set on (which is the loudest they go to) is 1. If you were to change the Audio Listener to 0, that would mute it. All you have to do is write a simple script like this:

function Update(){

	//Mute volume:
	AudioListener.volume = 0;

	//Set volume back to normal
	AudioListener.volume = 1;

	//Set volume to half of normal:
	AudioListener.volume = 0.5;

}

I think you get they idea by now!!! :smiley:

Comment back if you need more help

-Grady

If you want a slider you can use GUI.HorizontalSlider

var inGameVolume : float = 1.0;

function OnGUI () {
    inGameVolume = AudioListener.volume;
    inGameVolume = GUI.HorizontalSlider (Rect (25, 25, 100, 30), inGameVolume, 0.0, 1.0);
}

It should create a slider on your screen and you should be able to adjust your audio level with it.