static void SubscribeToUnityEvents()
        {
#if UNITY_EDITOR
            if (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode)
            {
                UnityEditor.EditorApplication.update            -= OnEditorUpdate;
                UnityEditor.EditorApplication.update            += OnEditorUpdate;
                UnityEditor.EditorApplication.pauseStateChanged -= HandleEditorPauseStateChange;
                UnityEditor.EditorApplication.pauseStateChanged += HandleEditorPauseStateChange;
                UnityEditor.EditorApplication.quitting          -= HandleOnApplicationQuit;
                UnityEditor.EditorApplication.quitting          += HandleOnApplicationQuit;
            }
            else
#endif
            {
                if (_instance == null)
                {
                    _instance = new GameObject("UnityLifecycleSubscriber").AddComponent <UnityLifecycleSubscriber>();
                    DontDestroyOnLoad(_instance);
                }
            }
        }
Exemple #2
0
 public AsyncHelper()
 {
     UnityLifecycleSubscriber.AddListener(this);
 }