【U3D】关于 IOSApp唤醒API: OnApplicationPause 和 OnApplicationFocus

    void OnApplicationPause()
    {
        Debug.Log("pause");
        isPause = true;
        isFocus = false;
    }

    void OnApplicationFocus()
    {
        Debug.Log("focus");
        isPause = false;
        isFocus = true;

    }


Xcode打印结果:

(按下Home键)

-> applicationWillResignActive()

focus

OnApplicationFocus()


pause

OnApplicationPause()

-> applicationDidEnterBackground()


(返回程序)

-> applicationWillEnterForeground()

-> applicationDidBecomeActive()

focus

OnApplicationFocus()


pause

OnApplicationPause()


所以整个流程: focus => pause => focus => pause。


你可能感兴趣的:(【U3D】关于 IOSApp唤醒API: OnApplicationPause 和 OnApplicationFocus)