Search Unity

OnApplicationPause in Android

Discussion in 'General Graphics' started by junqing_mark, Jul 17, 2020.

  1. junqing_mark

    junqing_mark

    Joined:
    Apr 18, 2020
    Posts:
    3
    Unity have OnApplicationPause && OnApplicationFocus to handle when press home button or power button.
    now I have a feature is that I want set Camera to a specific position when OnApplicationPause.
    Code (CSharp):
    1. private void OnApplicationPause(bool pause)
    2.     {
    3.         if (pause)
    4.         {
    5.             Debug.Log("OnApplicationPause true");
    6.             Camera.main.transform.position = new Vector3();
    7.          
    8.         }
    9.     }
    In document, unity says "One extra frame will be issued after OnApplicationPause is called to allow the game to show graphics that indicate the paused state."
    but I test it on Android, it didnot render actually, it renders when application come into front, in my case is the screen have a splash and camera go to the position I set in OnApplicationPuse.

    Did I miss something or Android didn't support this?