private void OnEnable() { this.titleContent = new GUIContent("Start Scene"); if (File.Exists(path)) { this.data = JsonHelper.FromJson <AlwaysLoadSceneWindowData>(File.ReadAllText(path)); } else { this.data = new AlwaysLoadSceneWindowData(); Save(); } }
private static void OnGameEnter() { if (File.Exists(path)) { AlwaysLoadSceneWindowData data = JsonHelper.FromJson <AlwaysLoadSceneWindowData>(File.ReadAllText(path)); if (data.isEnabled == true && string.IsNullOrEmpty(data.initSceneName) == false) { if (SceneManager.GetActiveScene().name != data.initSceneName) { SceneManager.LoadScene(data.initSceneName); } } } }