public static SceneTemplatePreferences Get() { if (s_Instance == null) { s_Instance = new SceneTemplatePreferences(); s_Instance.newDefaultSceneOverride = (NewDefaultSceneOverride)EditorPrefs.GetInt(GetPreferencesKey("newDefaultSceneOverride"), (int)NewDefaultSceneOverride.DefaultBuiltin); } return(s_Instance); }
static void InstantiateDefaultScene(CommandExecuteContext context) { if (SceneTemplatePreferences.Get().newDefaultSceneOverride == SceneTemplatePreferences.NewDefaultSceneOverride.DefaultBuiltin) { EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single); return; } var templateInfos = SceneTemplateUtils.GetSceneTemplateInfos(); var templateInfo = templateInfos.FirstOrDefault(info => info.isPinned && !info.IsInMemoryScene); if (templateInfo == null) { templateInfo = templateInfos.FirstOrDefault(info => !info.isPinned && !info.IsInMemoryScene); } if (templateInfo != null && templateInfo.sceneTemplate) { Instantiate(templateInfo.sceneTemplate, false); return; } EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single); }
public static void Save(SceneTemplatePreferences prefs = null) { prefs ??= Get(); EditorPrefs.SetInt(GetPreferencesKey("newDefaultSceneOverride"), (int)prefs.newDefaultSceneOverride); }