Beispiel #1
0
        private void OnDestroy()
        {
            if (this == instance)
            {
                instance = null;
            }

            // Re-initialize the tracker
            Init();
        }
Beispiel #2
0
        private static void Init()
        {
            // Check if the tracker has already been initialized
            if (instance != null && !instance.Equals(null))
            {
                return;
            }

            // Don't initialize if the application is quitting
            if (quitting)
            {
                return;
            }

            var gameObject = new GameObject("Motive");

            gameObject.hideFlags = HideFlags.HideAndDontSave;
            DontDestroyOnLoad(gameObject);

            instance = gameObject.AddComponent <Motive>();
        }