/// <summary>
        /// Unloads the currently loaded project. Offers the user a chance to save the current scene if it is modified.
        /// Automatically saves all project data before unloading.
        /// </summary>
        private static void UnloadProject()
        {
            Action continueUnload =
                () =>
            {
                Scene.Clear();

                if (monitor != null)
                {
                    monitor.Destroy();
                    monitor = null;
                }

                LibraryWindow window = EditorWindow.GetWindow <LibraryWindow>();
                if (window != null)
                {
                    window.Reset();
                }

                SetSceneDirty(false);
                Internal_UnloadProject();
                SetStatusProject(false);
            };

            Action <DialogBox.ResultType> dialogCallback =
                (result) =>
            {
                if (result == DialogBox.ResultType.Yes)
                {
                    SaveScene();
                }

                continueUnload();
            };

            if (IsSceneModified())
            {
                DialogBox.Open("Warning", "You current scene has modifications. Do you wish to save them first?",
                               DialogBox.Type.YesNoCancel, dialogCallback);
            }
            else
            {
                continueUnload();
            }
        }
Exemple #2
0
        /// <summary>
        /// Unloads the currently loaded project, without making any checks or requiring confirmation.
        /// </summary>
        private static void UnloadProject()
        {
            Scene.Clear();

            if (monitor != null)
            {
                monitor.Destroy();
                monitor = null;
            }

            LibraryWindow window = EditorWindow.GetWindow <LibraryWindow>();

            if (window != null)
            {
                window.Reset();
            }

            SetSceneDirty(false);
            Internal_UnloadProject();
            SetStatusProject(false);
        }