Example #1
0
 /// <summary>
 /// 終了処理
 /// </summary>
 void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;
     }
 }
Example #2
0
        /// <summary>
        /// 初期処理
        /// </summary>
        void Awake()
        {
            if (Instance != null)
            {
                Destroy(Instance);
            }

            Instance = this;

            // 起動時rootがNullの場合は自分につく
            if (_sceneRoot == null)
            {
                _sceneRoot = transform;
            }

            // シーン読み込み完了時
            SceneManager.sceneLoaded += (scene, loadMode) =>
            {
                loadedScene = scene;
            };
        }