Version: 5.5 (switch to 5.6b)
LanguageEnglish
  • C#
  • JS

Script language

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

EditorUtility.DisplayDialogComplex

public static int DisplayDialogComplex(string title, string message, string ok, string cancel, string alt);

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

} } }