예제 #1
0
        /// <summary>
        /// Called when the user requests that the editor shuts down. You must manually close the editor from this
        /// method if you choose to accept the users request.
        /// </summary>
        static void OnEditorQuitRequested()
        {
            if (delayQuit)
            {
                return;
            }

            EditorApplication.AskToSaveSceneAndContinue(
                () =>
            {
                if (ProjectLibrary.ImportInProgress)
                {
                    ConfirmImportInProgressWindow.Show();
                    delayQuit = true;
                }
                else
                {
                    EditorApplication.SaveProject();
                    EditorApplication.Quit();
                }
            });
        }
예제 #2
0
        /// <summary>
        /// Attempts to unload 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>
        /// <param name="onDone">Callback to trigger when project project unload is done.</param>
        private static void TryUnloadProject(Action onDone)
        {
            if (delayUnloadProject)
            {
                return;
            }

            AskToSaveSceneAndContinue(
                () =>
            {
                if (ProjectLibrary.ImportInProgress)
                {
                    ConfirmImportInProgressWindow.Show();
                    delayUnloadCallback = onDone;
                    delayUnloadProject  = true;
                }
                else
                {
                    UnloadProject();
                    onDone?.Invoke();
                }
            });
        }