# DisplayAlertDialog(string, string, string, DialogIconType)

> Displays a simple alert dialog box with a title, an icon, a message, and a single button.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public static void DisplayAlertDialog(string titleText, string messageText, string buttonText, DialogIconType iconType = DialogIconType.Warning)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The title of the dialog box. If left null, defaults to "Unity".**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The message to display in the dialog box.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The text to display on the button. If left null, defaults to "OK".**** (\[DialogIconType]\(/engine/6000.3/script-reference/unityeditor/dialogicontype)): The icon to display in the dialog box. Defaults to [DialogIconType.Warning](/engine/6000.3/script-reference/unityeditor/dialogicontype/warning.md).

### Remarks

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 `buttonText` is longer than 64 characters, an `ArgumentException` is thrown. The following example demonstrates how to display a simple alert dialog box with a warning icon, a title, a message, and an OK button.

```csharp
using UnityEditor;
using UnityEngine;

namespace Examples
{
    public class DisplayAlertDialogExamples : MonoBehaviour
    {
        [MenuItem("Window/EditorDialog Example/DisplayAlertDialog with all parameters specified")]
        public static void DisplayAlertDialogExample()
        {
            EditorDialog.DisplayAlertDialog(
                "Unity - Custom Title",
                "This is a test of the EditorDialog API",
                "Custom Button",
                DialogIconType.Info);
        }

        [MenuItem("Window/EditorDialog Example/DisplayAlertDialog with defaults")]
        public static void DisplayAlertDialogSimpleExample()
        {
            EditorDialog.DisplayAlertDialog(null, "This is a test of the EditorDialog API with defaults.", null);
        }
    }
}
```

Produces the following dialog boxes on Windows 11:

![DisplayAlertDialogExample (DisplayAlertDialog(string, string, string, DialogIconType))](/api/media?file=/engine/6000.3/media/images/DisplayAlertDialogExample.png)

![DisplayAlertDialogSimpleExample (DisplayAlertDialog(string, string, string, DialogIconType))](/api/media?file=/engine/6000.3/media/images/DisplayAlertDialogSimpleExample.png).
