void StartTutorialInEditMode() { // TODO HACK double delay to resolve various issue (e.g. black screen during save modifications dialog // Revisit and fix properly. EditorApplication.delayCall += delegate { EditorApplication.delayCall += delegate { if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { return; } // TODO document why this is done EditorWindow.GetWindow <SceneView>().Focus(); SaveOriginalScenes(); SaveOriginalWindowLayout(); m_Tutorial.LoadWindowLayout(); // Ensure TutorialWindow is open and set the current tutorial var tutorialWindow = EditorWindow.GetWindow <TutorialWindow>(); tutorialWindow.SetTutorial(m_Tutorial); m_Tutorial.ResetProgress(); // Do not overwrite workspace in authoring mode, use version control instead. if (!ProjectMode.IsAuthoringMode()) { LoadTutorialDefaultsIntoAssetsFolder(); } }; }; }
void StartTutorialImmediateEditMode() { if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { return; } // Prevent Game view flashing briefly when starting tutorial. EditorWindow.GetWindow <SceneView>().Focus(); SaveOriginalScenes(); SaveOriginalWindowLayout(); SaveSceneViewState(); m_Tutorial.LoadWindowLayout(); // Ensure TutorialWindow is open and set the current tutorial var tutorialWindow = EditorWindow.GetWindow <TutorialWindow>(); tutorialWindow.SetTutorial(m_Tutorial, false); m_Tutorial.ResetProgress(); // Do not overwrite workspace in authoring mode, use version control instead. if (!ProjectMode.IsAuthoringMode()) { LoadTutorialDefaultsIntoAssetsFolder(); } }
void StartTutorialInEditMode() { if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { return; } // Postpone start of tutorial until window is closed var tutorialWindow = GetTutorialWindow(); if (tutorialWindow != null) { tutorialWindow.Close(); AfterWindowClosed += StartTutorialInEditMode; return; } AfterWindowClosed -= StartTutorialInEditMode; SaveOriginalScenes(); SaveOriginalWindowLayout(); m_Tutorial.LoadWindowLayout(); // Ensure TutorialWindow is open and set the current tutorial tutorialWindow = EditorWindow.GetWindow <TutorialWindow>(); tutorialWindow.SetTutorial(m_Tutorial); m_Tutorial.ResetProgress(); // Do not overwrite workspace in authoring mode, use version control instead. if (!ProjectMode.IsAuthoringMode()) { LoadTutorialDefaultsIntoAssetsFolder(); } }