[Not Fixed] Music doesent mute, please help

Hello i have a problem i have a unmute button that gonna mute my background music but it doesent mute it, it worked until i upgraded unity 4.0 to 4.2
this is my script:

   	    public bool muted = false;
   	    string buttonTextaudio = "MUTE";

        if (GUI.Button(new Rect(655, 435, 125, 25), buttonTextaudio, style))
    	{
    		audio.PlayOneShot(buttonsound);
        	if(muted == false)
    		{
            	AudioListener.volume = 0.0F;
            	muted = true;
            	buttonTextaudio = "UNMUTE";
        	}
        	else  
       		{
            	AudioListener.volume = 1.0F;
            	muted = false;
            	buttonTextaudio = "MUTE";
        	}
     	}

I have seen more people that have this problem and its a Unity 4.2 bug

This line:

AudioListener.volume = GUI.HorizontalSlider(new Rect(432, 420, 600, 30), AudioListener.volume, 0.0F, 1.0F);

is going to override your 0 or 1 on every tick. That’s what’s wrong. I don’t know how it worked before. Maybe now you can’t set that volume in the same frame twice? In any case, it’s better UI to explicitly have a Mute button that does NOT change the volume. Otherwise, when you unmute, volume will go to full, which is probably not wanted.

Better to have a boolean ‘mute’ and new float value which holds the volume level, and use that for the slider, set it only when mute is false. When mute is true, set AudioListener volume to 0, when mute goes false, set that to the new float value.