title: Sound issue in an android game made in Unity
body: <p>I have made a 2d game for android in Unity and there is an issue.
  There are sounds in the game (e.g. menu button sound) that work perfectly.</p>
  
  <p>When I leave the game (e.g. with the home button) and come back, the sounds work well, too.</p>
  
  <p>But if I get a sound notification (email, skpye etc), the game gets mute until I exit and restart the game.</p>
  
  <p>I tried to search for the solution and I found OnApplicationPause method, but it doesn't help me. I don't know why... </p>
  
  <p>Does someone have any idea what could be the problem or the solution :)?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT</p>
  
  <p>I connected my phone to the computer and tried to debug and follow the OnApplicationPause method.</p>
  
  <p>The sound is playing when the game starts.</p>
  
  <p>If I press the home button, the audioSource.Pause(); is called and when I'm back to the game the audioSource.UnPause(); is also called. And there is sound.</p>
  
  <p>If I get a phone call, the audioSource.Pause(); is called and when I'm back to the game the audioSource.UnPause(); is also called. But there is no sound.</p>
  
  <p>If I get a notifications (e.g. email) there is no audioSource.Pause() statement and the sound is gone.</p>
  
  <p>The  'if (audioSource == null)' and the 'if (!audioSource.isPlaying)' statements are never called.</p>
  
  <pre><code>private AudioSource audioSource;
  public AudioClip clip;
  
  void Awake() {
      if (audioSource == null) {
          audioSource = gameObject.AddComponent&lt;AudioSource&gt;();
          audioSource.loop = true;
          audioSource.clip = clip;
      }
  
      if (!audioSource.isPlaying) {
          audioSource.Play();
      }
  }
  
  void OnApplicationPause(bool pauseStatus) {
      //Check if this is Pause
      if (pauseStatus)
      {
          //Pause Audio if it is playing
          if (audioSource.isPlaying)
          {
              audioSource.Pause();
  
              //Set to true so that we will detamine whether to Play() or UnPause() the music next time
              audioSourcePaused = true;
              Debug.Log("ifplaying-&gt;pause");
          }
          Debug.Log("pause");
      }
  
      //Check if this is Resume
      if (!pauseStatus) {
          //Make sure audio is not null. If null, getComponent again
          if (audioSource == null) {
              audioSource = gameObject.AddComponent&lt;AudioSource&gt;();
              audioSource.loop = true;
              audioSource.clip = clip;
              Debug.Log("Null");
          }
  
          //Check if we paused the audio then resume
          if (audioSourcePaused) {
              audioSource.UnPause();
  
              //Set to false so that we will detamine whether to Play() or UnPause() the music next time
              audioSourcePaused = false;
              Debug.Log("Unpause");
          }
  
          //Check if Audio is playing. Don't play if already playing. 
          if (!audioSource.isPlaying) {
              audioSource.Play();
              Debug.Log("play");
          }
      }
  }
  </code></pre>