/// <summary> /// 終了処理 /// </summary> void OnDestroy() { if (Instance == this) { Instance = null; } }
/// <summary> /// 初期処理 /// </summary> void Awake() { if (Instance != null) { Destroy(Instance); } Instance = this; // 起動時rootがNullの場合は自分につく if (_sceneRoot == null) { _sceneRoot = transform; } // シーン読み込み完了時 SceneManager.sceneLoaded += (scene, loadMode) => { loadedScene = scene; }; }