Esempio n. 1
0
        private void InitializeInternal()
        {
            lock (initializedLock)
            {
                if (IsInitialized)
                {
                    return;
                }

                instance = this;

                if (Application.isPlaying)
                {
                    DontDestroyOnLoad(instance.transform.root);
                }

                Application.quitting += ApplicationOnQuitting;

#if UNITY_EDITOR
                UnityEditor.EditorApplication.playModeStateChanged += playModeState =>
                {
                    if (playModeState == UnityEditor.PlayModeStateChange.ExitingEditMode && activeProfile == null)
                    {
                        UnityEditor.EditorApplication.isPlaying = false;
                        UnityEditor.Selection.activeObject      = Instance;
                        UnityEditor.EditorGUIUtility.PingObject(Instance);
                    }
                };
#endif // UNITY_EDITOR

                Initialize();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Static function to determine if the MixedRealityToolkit class has been initialized or not.
        /// </summary>
        /// <returns></returns>
        public static bool ConfirmInitialized()
        {
            // ReSharper disable once UnusedVariable
            // Assigning the Instance to access is used Implicitly.
            MixedRealityToolkit access = Instance;

            return(IsInitialized);
        }
Esempio n. 3
0
        private void OnDestroy()
        {
            DestroyAllServices();

            if (instance == this)
            {
                instance          = null;
                searchForInstance = true;
            }
        }