Beispiel #1
0
    void OnApplicationFocus(bool focused)
    {
        // This check ensures that we don't send a PauseMessage when running in editor or on a desktop build for development
        if (!Application.isEditor && Application.platform != RuntimePlatform.WindowsPlayer && Application.platform != RuntimePlatform.OSXPlayer)
        {
            UserData.Instance.IsUnityAppPaused = !focused;

            if (!focused)
            {
                client.StopReadTimer();
                client.SendAppPaused();
            }
            else
            {
                client.ResetReadTimer();
                client.SendAppResumed();
            }
            Debug.Log("OnApplicationFocus, focused: " + focused);
        }
    }