ValidateBuildSettings() public static method

public static ValidateBuildSettings ( List &invalidScenes ) : bool
invalidScenes List
return bool
Esempio n. 1
0
    private static void MonitorStateChange()
    {
        if (EditorApplication.isPlayingOrWillChangePlaymode)
        {
            List <string> invalidScenes;

            if (!TextScene.ValidateBuildSettings(out invalidScenes))
            {
                EditorApplication.isPlaying = false;


                StringBuilder sb = new StringBuilder();

                sb.Append("Errors were found while validating Build Settings: \n");

                foreach (string scene in invalidScenes)
                {
                    sb.Append("   ");
                    sb.Append(scene);
                    sb.Append('\n');
                }

                sb.Append("Your levels may not switch correctly in play-mode! Do you want to fix up any outdated/missing temp file issues now?");

                if (EditorUtility.DisplayDialog("Build settings", sb.ToString(), "Yes", "No"))
                {
                    TextScene.BuildTempScenes(invalidScenes);
                }
            }
        }
    }
Esempio n. 2
0
    void OnGUI()
    {
        GUILayout.BeginVertical();

        scroll = GUILayout.BeginScrollView(scroll);

        GUILayout.Label("Scenes to build");

        foreach (string scene in scenes)
        {
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button(scene))
            {
                TextSceneDeserializer.LoadSafe(EditorHelper.GetProjectFolder() + scene);
                GUIUtility.ExitGUI();
                return;
            }


            if (GUILayout.Button("Remove", GUILayout.MaxWidth(60)))
            {
                if (EditorUtility.DisplayDialog("Remove scene", "Are you sure you want to remove this scene from the build settings?", "Yes", "No"))
                {
                    TextScene.RemoveSceneFromBuild(scene);
                    LoadSettings();
                }
            }

            if (GUILayout.Button("+", GUILayout.MaxWidth(20)))
            {
                TextScene.MoveScenePosition(scene, 1);
                LoadSettings();
            }

            if (GUILayout.Button("-", GUILayout.MaxWidth(20)))
            {
                TextScene.MoveScenePosition(scene, -1);
                LoadSettings();
            }

            GUILayout.EndHorizontal();
        }

        if (scenes.Count > 0)
        {
            EditorGUILayout.Separator();
            EditorGUILayout.BeginVertical(GUILayout.MaxWidth(150));

            if (GUILayout.Button("Build Temp"))
            {
                TextScene.BuildTempScenes();
                GUIUtility.ExitGUI();
                return;
            }

            if (GUILayout.Button("Build Streamed Web"))
            {
                TextScene.Build(BuildTarget.WebPlayerStreamed);
                GUIUtility.ExitGUI();
                return;
            }

            if (GUILayout.Button("Build Web"))
            {
                TextScene.Build(BuildTarget.WebPlayer);
                GUIUtility.ExitGUI();
                return;
            }

            if (GUILayout.Button("Build OSX"))
            {
                TextScene.Build(BuildTarget.StandaloneOSXUniversal);
                GUIUtility.ExitGUI();
                return;
            }

            if (GUILayout.Button("Build Windows"))
            {
                TextScene.Build(BuildTarget.StandaloneWindows);
                GUIUtility.ExitGUI();
                return;
            }

            EditorGUILayout.EndVertical();
        }
        else
        {
            GUILayout.Label("Add scenes via the TextScene menu item to enable build");
        }

        EditorGUILayout.Separator();

        if (GUILayout.Button("Add current", GUILayout.MaxWidth(100)))
        {
            TextScene.AddCurrentSceneToBuild();
            LoadSettings();
        }

        EditorGUILayout.Separator();

        if (GUILayout.Button("Validate Settings", GUILayout.MaxWidth(100)))
        {
            List <string> invalidScenes;

            if (TextScene.ValidateBuildSettings(out invalidScenes))
            {
                EditorUtility.DisplayDialog("Valid settings", "The build settings seem valid enough", "OK");
            }
            else
            {
                StringBuilder sb = new StringBuilder();

                sb.Append("There were errors in validation: \n");

                foreach (string scene in invalidScenes)
                {
                    sb.Append("   ");
                    sb.Append(scene);
                    sb.Append('\n');
                }

                sb.Append("Try running 'Build Temp' to fix them up, or inspect the console for further hints.");

                EditorUtility.DisplayDialog("Validation failed", sb.ToString(), "OK");
            }
        }

        GUILayout.EndScrollView();

        GUILayout.EndVertical();
    }