Search Unity

Mobile: Detecting when the application is put into the background. Not OnApplicationPause, LostFocus

Discussion in 'General Discussion' started by MechaKondor, Oct 16, 2019.

  1. MechaKondor

    MechaKondor

    Joined:
    Sep 4, 2017
    Posts:
    5
    I know that the application can detect when it is paused through OnApplicationPause, or OnLostFocus. These would work fine for my situation since I do need the game to perform an action when the player puts the app into the background. Except that OnApplicationPause is also triggered by the player locking their phone using the power button.

    I do not want the game to trigger the action when the player locks their phone, so I can't use the above-mentioned methods, are there any other ways to detect when the app is paused? Or maybe a way to filter out what triggered the pause of the app?

    Any help would be appreciated, thanks for spending your time to read this.
     
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,982
    Joe-Censored likes this.