Ejemplo n.º 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()
        {
            Action <DialogBox.ResultType> dialogCallback =
                (result) =>
            {
                if (result == DialogBox.ResultType.Yes)
                {
                    TrySaveScene();
                }
                else if (result == DialogBox.ResultType.No)
                {
                    EditorApplication.SaveProject();
                    EditorApplication.Quit();
                }
            };

            if (EditorApplication.IsSceneModified())
            {
                DialogBox.Open("Warning", "You current scene has modifications. Do you wish to save them first?",
                               DialogBox.Type.YesNoCancel, dialogCallback);
            }
            else
            {
                EditorApplication.SaveProject();
                EditorApplication.Quit();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts the build process for the currently selected platform.
        /// </summary>
        private void Build()
        {
            ProgressBar.Show(new LocEdString("Building..."), 0.0f);

            EditorApplication.SaveProject();
            // HACK - Delay build one frame so that progress bar has a chance to show. Use coroutines here once implemented.
            buildScheduledFrame = Time.FrameIdx + 1;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Attempts to save the current scene, and keeps retrying if failed or until user cancels.
        /// </summary>
        static void TrySaveScene()
        {
            Action success = () =>
            {
                EditorApplication.SaveProject();
                EditorApplication.Quit();
            };

            EditorApplication.SaveScene(success, TrySaveScene);
        }