- Home /
Set volume problems
So, i'm having problems with setting the volume of the music thru the whole game. First of all, i have the main menu playing one song, then, if i want change the volume, i have to click the configuration button (GUI), that's load a new scene where besides others settings i can change de volume with a slider. I have tried to make a empty object, them putting audio source and listener. Then i go to the horizontal slider on "On Value Change" i put the game object, selecting the Audio Listener, and volume (Dynamic float). which lead me to this: . But if i do it with the regular audio dynamic float volume, i can hear the volume changing. And i learned that, to change the music level i have to do it on the audio listner, if i want that the music playing in futures scenes remains the same level.
Or have i undertand that function erroneously ? If so, how do i do it ?
Ps: For now, lets not take in consideration the fact that changing scenes the music change, or restart.
Thanks for your time
Answer by Kaz_Yamof · Mar 17, 2015 at 03:52 PM
Hello healthy guy! If I get it right, each scene can have only one Audio Listener (see documentation). So you only need to change the volume property on AudioListener (http://docs.unity3d.com/ScriptReference/AudioListener-volume.html). This should work.
[edit:] You said you can hear the music changing when edits the volume of AudioSource, right? I think this occurs because the volume of audiosource is given by this property: "Volume: How loud the sound is at a distance of one world unit (one meter) from the Audio" Listener (http://docs.unity3d.com/Manual/class-AudioSource.html).