コード例 #1
0
        internal static void RunStartupCode()
        {
            var projectSettings = TutorialProjectSettings.instance;

            if (projectSettings.initialScene != null)
            {
                EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(projectSettings.initialScene));
            }

            TutorialManager.WriteAssetsToTutorialDefaultsFolder();

            // Ensure Editor is in predictable state
            EditorPrefs.SetString("ComponentSearchString", string.Empty);
            Tools.current = Tool.Move;

            var readme = TutorialWindow.FindReadme();

            if (readme != null)
            {
                ShowTutorialWindow();
            }

            // NOTE camera settings can be applied successfully only after potential layout changes
            if (projectSettings.InitialCameraSettings != null && projectSettings.InitialCameraSettings.enabled)
            {
                projectSettings.InitialCameraSettings.Apply();
            }

            if (projectSettings.WelcomePage)
            {
                TutorialModalWindow.TryToShow(projectSettings.WelcomePage, () => {});
            }
        }
コード例 #2
0
        internal static void RunStartupCode()
        {
            var projectSettings = TutorialProjectSettings.instance;

            if (projectSettings.initialScene != null)
            {
                EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(projectSettings.initialScene));
            }

            TutorialManager.WriteAssetsToTutorialDefaultsFolder();

            if (projectSettings.startupTutorial != null)
            {
                TutorialManager.instance.StartTutorial(projectSettings.startupTutorial);
            }

            // Ensure Editor is in predictable state
            EditorPrefs.SetString("ComponentSearchString", string.Empty);
            Tools.current = Tool.Move;

            // Replace LastProjectPaths in window layouts used in tutorials so that e.g.
            // pre-saved Project window states work correctly.
            var readme = TutorialWindow.FindReadme();

            if (readme)
            {
                WindowLayoutProxy.ReplaceLastProjectPathWithCurrentProjectPath(readme.projectLayoutPath);
            }

            AssetDatabase.FindAssets($"t:{typeof(Tutorial).FullName}")
            .Select(guid =>
                    AssetDatabase.LoadAssetAtPath <Tutorial>(AssetDatabase.GUIDToAssetPath(guid)).windowLayoutPath
                    )
            .Distinct()
            .ToList()
            .ForEach(layoutPath =>
            {
                WindowLayoutProxy.ReplaceLastProjectPathWithCurrentProjectPath(layoutPath);
            });

            if (readme != null)
            {
                readme.LoadTutorialProjectLayout();
            }

            var welcomePage = FindWelcomePage();

            if (welcomePage != null)
            {
                TutorialModalWindow.TryToShow("Welcome", welcomePage, () => { });
            }

            var wnd = TutorialManager.GetTutorialWindow();

            if (wnd)
            {
                wnd.showStartHereMarker = true;
            }
        }
コード例 #3
0
        /// <summary>
        /// Shows Tutorials window using the currently specified behaviour:
        /// - if TutorialContainer exists and TutorialContainer.ProjectLayout is specified,
        ///   the window is loaded and shown using the specified window layout (old behaviour), or
        /// - else the window is shown by anchoring and docking next to the Inspector (new behaviour).
        /// </summary>
        public static void ShowTutorialWindow()
        {
            var readme = TutorialWindow.FindReadme();

            if (readme == null || readme.ProjectLayout == null)
            {
                TutorialWindow.CreateNextToInspector();
            }
            else if (readme.ProjectLayout != null)
            {
                TutorialWindow.CreateWindowAndLoadLayout();
            }
        }