- Home /
Question by
DGKN · Jul 29, 2014 at 07:05 PM ·
androidmobilepauseonapplicationpause
Android - Mute button not working when returning from home screen
Hi,
My game has a mute button which saves when you quit. The problem is, when you press "Home Button" and return back to the game, music plays even though Mute button is ON.
I've tried : OnApplicationPause, OnApplicationFocus, etc but it doesn't seem to work. Do you know any workaround to fix this ? Thanks in advance !
int IsMuted;
void OnApplicationPause(bool Pause)
{
if(Pause)
SoundCheck ();
}
void SoundCheck()
{
IsMuted = PlayerPrefs.GetInt("Sound");
if(IsMuted == 1)
{
AudioListener.pause = false;
}
else
{
AudioListener.pause = true;
}
}
Comment
Best Answer
Answer by DGKN · Jul 29, 2014 at 07:30 PM
Sorry guys, I've fixed the problem by changing if(Pause) to if(!Pause).