title: Toggle Mute in Unity 4.6
body: <p>I'm making my own game in Unity 4.6. I have background music playing all the time. But i want to give my players the possibility to mute the music with a simple toggle.
  I'm using C#. Anyone any ideas on how to do this?</p>
  
  <p>Would be a great help!
  this is how i solved it!</p>
  
  <pre><code>using UnityEngine;
  </code></pre>
  
  <p><code>using System.Collections;</code></p>
  
  <p><code>public class Mute: MonoBehaviour{</code></p>
  
  <pre><code>bool isMute;
  
  
  public void MusicMute (){
      if(isMute == true){
          Debug.Log("Music On");
          AudioListener.volume = 1;
          isMute = false;
      }
      else {
          Debug.Log("Music Off");
          isMute = true;
          AudioListener.volume = 0;
      }
  }   
  </code></pre>
  
  <p>}</p>