private void ToolbarGUI() { EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)); // scenes cannot be loaded while in play mode using (new EditorGUI.DisabledScope(EditorApplication.isPlaying)) { if (GUILayout.Button("Load Tutorial", EditorStyles.toolbarButton, GUILayout.MaxWidth(s_AuthoringModeToolbarButtonWidth))) { OpenLoadTutorialDialog(); GUIUtility.ExitGUI(); // Workaround: Avoid re-entrant OnGUI call when calling EditorSceneManager.NewScene } } GUILayout.FlexibleSpace(); if (GUILayout.Button("Run Startup Code", EditorStyles.toolbarButton, GUILayout.MaxWidth(s_AuthoringModeToolbarButtonWidth))) { UserStartupCode.RunStartupCode(); } EditorGUI.BeginChangeCheck(); maskingEnabled = GUILayout.Toggle( maskingEnabled, "Preview Masking", EditorStyles.toolbarButton, GUILayout.MaxWidth(s_AuthoringModeToolbarButtonWidth) ); if (EditorGUI.EndChangeCheck()) { ApplyMaskingSettings(true); GUIUtility.ExitGUI(); return; } EditorGUILayout.EndHorizontal(); }
void ToolbarGUI() { EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)); bool Button(string text) { return(GUILayout.Button(text, EditorStyles.toolbarButton, GUILayout.MaxWidth(s_AuthoringModeToolbarButtonWidth))); } using (new EditorGUI.DisabledScope(currentTutorial == null)) { if (Button("Select Tutorial")) { Selection.activeObject = currentTutorial; } using (new EditorGUI.DisabledScope(currentTutorial?.currentPage == null)) { if (Button("Select Page")) { Selection.activeObject = currentTutorial.currentPage; } } if (Button("Skip To End")) { currentTutorial.SkipToLastPage(); } } GUILayout.FlexibleSpace(); if (Button("Run Startup Code")) { UserStartupCode.RunStartupCode(); } using (new EditorGUI.DisabledScope(currentTutorial == null)) { EditorGUI.BeginChangeCheck(); maskingEnabled = GUILayout.Toggle( maskingEnabled, "Preview Masking", EditorStyles.toolbarButton, GUILayout.MaxWidth(s_AuthoringModeToolbarButtonWidth) ); if (EditorGUI.EndChangeCheck()) { ApplyMaskingSettings(true); GUIUtility.ExitGUI(); return; } } EditorGUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { if (GUILayout.Button(TutorialWindowMenuItem.Item)) { UserStartupCode.ShowTutorialWindow(); } if (k_IsAuthoringMode) { base.OnInspectorGUI(); } }
static void OpenTutorialWindow() { UserStartupCode.ShowTutorialWindow(); }