internal static void RunStartupCode(TutorialProjectSettings projectSettings)
        {
            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;

            if (TutorialEditorUtils.FindAssets <TutorialContainer>().Any())
            {
                var existingWindow = EditorWindowUtils.FindOpenInstance <TutorialWindow>();
                if (existingWindow)
                {
                    existingWindow.Close();
                }
                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
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            if (GUILayout.Button(Localization.Tr("Show Welcome Dialog")))
            {
                TutorialModalWindow.TryToShow(Target, null);
            }

            if (k_IsAuthoringMode)
            {
                GUILayout.Space(10);
                //base.OnInspectorGUI();
                DrawPropertiesExcluding(serializedObject, k_PropsToIgnore);
            }

            bool eventOffOrRuntimeOnlyExists = false;

            for (int i = 0; i < m_Buttons.arraySize; i++)
            {
                m_CurrentEvent = m_Buttons.GetArrayElementAtIndex(i).FindPropertyRelative(k_OnClickEventPropertyPath);
                if (!TutorialEditorUtils.EventIsNotInState(m_CurrentEvent, UnityEngine.Events.UnityEventCallState.EditorAndRuntime))
                {
                    continue;
                }

                eventOffOrRuntimeOnlyExists = true;
                break;
            }
            if (eventOffOrRuntimeOnlyExists)
            {
                TutorialEditorUtils.RenderEventStateWarning();
            }
            serializedObject.ApplyModifiedProperties();
        }
        static void OpenWelcomeDialog()
        {
            var welcomePage = TutorialProjectSettings.Instance.WelcomePage;

            if (welcomePage != null)
            {
                TutorialModalWindow.TryToShow(welcomePage, () => { });
            }
            else
            {
                Debug.LogError("No TutorialProjectSettings.WelcomePage set.");
            }
        }