Unity - Scripting API: EditorDialog.DisplayDecisionDialog
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.
Submission failed
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Declaration
public static bool DisplayDecisionDialog(string titleText, string messageText, string yesButtonText, string noButtonText, DialogIconType iconType);
Parameters
| Parameter | Description |
|---|---|
| titleText | The title of the dialog box. If left null, defaults to "Unity". |
| messageText | The message to display in the dialog box. |
| yesButtonText | The text to display on the Yes button. If left null, it defaults to "Yes". |
| noButtonText | The text to display on the No button. If left null, it defaults to "No". |
| iconType | The icon to display in the dialog box. Defaults to DialogIconType.Warning. |
Returns
bool
Returns true if the user clicked the Yes button, false if the user clicked the No button.
Description
Displays a decision dialog box with a title, icon, message, and two buttons.
If messageText is null or whitespace, an ArgumentNullException is thrown.
If messageText is longer than 512 characters, it is truncated and the full message is logged to the console in markdown format.
If any button's text is longer than 64 characters, an ArgumentException is thrown.
The default button is the Yes button. If the user presses the enter key (return key on macOS), the Yes button is clicked. The other button is the No button. If the user presses the escape key or closes the dialog, the No button is clicked. On macOS, the orientation of the buttons might be horizontal or vertical depending on the length of the message.
The following example demonstrates how to display a decision dialog box with a warning icon, a title, a message, and Yes and No buttons.
Produces the following dialog boxes on macOS:

.