Pause the app on reopen

When an app is shut down, the reopened, often, major games, pause their screen. So, if you open it up, in the next minute, the game scene is where you left it but paused. How can I know when my app is shut down with the home btn or otherwise, so, I can pause the app?

Add this method to a Monobehaviour in the scene:

    public void OnApplicationPause(bool isGamePaused)
    {
        if(isGamePaused)
        {
            //Do Something
        }
    }

Sorry for asking, but the description “Sent to all game objects when the player pauses.” Does not seem, accurate. Does pause mean, pressing the devices home btn?

The Pause/Unpause are tied to iOS via the following code in the AppDelegate.mm file when you generate a project. Do some Googling for these method names to see what they really mean to iOS:

- (void) applicationDidBecomeActive:(UIApplication*)application
{
    printf_console("-> applicationDidBecomeActive()\n");
    if (_didResignActive)
    {
        UnityPause(false);
    }

    _didResignActive = NO;
}

- (void) applicationWillResignActive:(UIApplication*)application
{
    printf_console("-> applicationWillResignActive()\n");
    UnityPause(true);

    _didResignActive = YES;
}

So, what I would inevitably like to do, is, if the app is opened, and gameplay is loaded, not scene 0, … So level 3 where hero was last scene shooting his gun… That the pause menu is loaded. If these exist in mm files, I need to pass this info, to a custom script. I am a little shakes here but will look up.

Thanks.