Legacy Documentation: Version 5.2
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

EditorUtility.DisplayDialogComplex

Suggest a change

Success!

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.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public static function DisplayDialogComplex(title: string, message: string, ok: string, cancel: string, alt: string): int;
public static int DisplayDialogComplex(string title, string message, string ok, string cancel, string alt);

Parameters

Description

Displays 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.


Display dialog complex for the example below.

	// 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.");

} } }