Select your preferred scripting language. All code snippets will be displayed in this language.
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseDisplays a modal dialog with three buttons.
Use it for displaying message boxes in the editor.
Similar to DisplayDialog, only this version shows a dialog with three buttons.ok
, cancel
and alt/
are labels to be displayed on the buttons. DisplayDialogComplex returns an integer 0, 1 or 2 corresponding to
ok, cancel and alt buttons.See Also: DisplayDialog function.// Lets you save, save and quit or quit without saving class EditorUtilityDisplayDialogComplex extends MonoBehaviour { @MenuItem("Examples/Enhanced Save") static function Init() { var option = EditorUtility.DisplayDialogComplex( "What do you want to do?", "Please choose one of the following options.", "Save Scene", "Save and Quit", "Quit without saving"); switch (option) { // Save Scene case 0: EditorApplication.SaveScene(EditorApplication.currentScene); break; // Save and Quit. case 1: EditorApplication.SaveScene(EditorApplication.currentScene); EditorApplication.Exit(0); break; // Quit Without saving. case 2: EditorApplication.Exit(0); break; default: Debug.LogError("Unrecognized option."); } } }