Example #1
0
        protected void OnDestroy()
        {
            if (_instance != this) {
                return;
            }

            // Cleanup.
            OnMainEnd ();

            Instance = null;
        }
Example #2
0
        protected void Awake()
        {
            // Only allow single instance to exist.
            if (_instance != null && _instance != this) {
                Destroy (gameObject);
                return;
            }

            Instance = this;
            DontDestroyOnLoad (gameObject);

            // Invoke main.
            OnMainBegin ();
        }