How to automatically switch to pause screen when user turns off the phone?

Hello there Unity Community,

I wanted to know how I could switch screens to my pause screen when a person who is trying out my app on his phone decides to turn off the screen. I want the game to already have switched to my pause screen when he returns to the game.

Thanks in advance :slight_smile:

Hey! For such simple questions it might be more efficient to ask in ‘Answers’ forum.

I think using OnApplicationFocus and OnApplicationPause should work in your case : )

void OnApplicationFocus(bool pauseStatus) 
{
    if(pauseStatus)
    {
        //your app is NO LONGER in the background
    }
    else
    {
        //your app is now in the background
    }
}

Read more here:

1 Like