Message Box Library
Native Windows message-box and task-dialog nodes with synchronous and async variants.
Use this library for confirmations, diagnostics, launchers, setup prompts, and native modal dialogs.
Python examples use Unreal's reflected API names through the unreal module. Async action variants are intentionally left as C++-only examples because they are not practical to drive from Unreal Python.
Show Native Message Box
Shows a standard Windows message box immediately.
| Pin | Direction | Purpose |
|---|---|---|
Title | Input | Dialog window title. |
Message | Input | Main message text. |
Buttons | Input | Standard Windows button layout. |
Icon | Input | Optional native icon style. |
Confirmed | Output | Fires when the player clicks OK or Yes. |
Declined | Output | Fires when the player clicks No. |
Canceled | Output | Fires when the player cancels or closes the dialog. |
#include "MessageBoxWindows.h"
EMessageBoxResult Result = EMessageBoxResult::Canceled;
UNativeMessageBox::ShowNativeMessageBox(
TEXT("Confirm"),
TEXT("Continue?"),
EMessageBoxButtons::YesNoCancel,
EWNTMessageBoxIcon::Question,
Result
);import unreal
result = unreal.NativeMessageBox.show_native_message_box(
"Confirm",
"Continue?",
unreal.MessageBoxButtons.YES_NO_CANCEL,
unreal.WNTMessageBoxIcon.QUESTION,
)Show Native Message Box Async
Shows the same Windows message box on a worker thread and keeps Blueprint flow responsive.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
Title | Input | Dialog window title. |
Message | Input | Main message text. |
Buttons | Input | Standard Windows button layout. |
Icon | Input | Optional native icon style. |
Then | Output | Continues immediately after the async action is created. |
On Confirmed | Output | Fires when the player clicks OK or Yes. |
On Declined | Output | Fires when the player clicks No. |
On Canceled | Output | Fires when the player cancels or closes the dialog. |
#include "MessageBoxWindows.h"
UFUNCTION()
void HandleDialogConfirmed();
UFUNCTION()
void HandleDialogDeclined();
UFUNCTION()
void HandleDialogCanceled();
UAsyncNativeMessageBoxAction* Action =
UAsyncNativeMessageBoxAction::ShowNativeMessageBoxAsync(
this,
TEXT("Confirm"),
TEXT("Continue?"),
EMessageBoxButtons::YesNoCancel,
EWNTMessageBoxIcon::Question);
Action->OnConfirmed.AddDynamic(this, &UMyObject::HandleDialogConfirmed);
Action->OnDeclined.AddDynamic(this, &UMyObject::HandleDialogDeclined);
Action->OnCanceled.AddDynamic(this, &UMyObject::HandleDialogCanceled);Show Regular Message Box
Shows the custom native task-dialog version with your own button text.
| Pin | Direction | Purpose |
|---|---|---|
Title | Input | Dialog window title. |
Message | Input | Main message text. |
Icon | Input | Optional native icon style. |
FirstButtonText | Input | Text shown on the primary button. |
SecondButtonText | Input | Text shown on the secondary button. |
bShowSecondButton | Input | Controls whether the second button is shown. |
First Button Clicked | Output | Fires when the primary button is chosen. |
Second Button / Cancel | Output | Fires when the second button is chosen or the dialog is canceled. |
#include "MessageBoxWindows.h"
ECustomDialogResult Result = ECustomDialogResult::SecondButton;
UNativeMessageBox::ShowMessageBox(
TEXT("Install"),
TEXT("Start installation now?"),
EWNTMessageBoxIcon::Information,
TEXT("Start"),
TEXT("Later"),
true,
Result
);import unreal
result = unreal.NativeMessageBox.show_message_box(
"Install",
"Start installation now?",
unreal.WNTMessageBoxIcon.INFORMATION,
"Start",
"Later",
True,
)Show Regular Message Box Async
Shows the custom task dialog asynchronously.
| Pin | Direction | Purpose |
|---|---|---|
WorldContextObject | Input | Async action registration context. |
Title | Input | Dialog window title. |
Message | Input | Main message text. |
Icon | Input | Optional native icon style. |
FirstButtonText | Input | Text shown on the primary button. |
SecondButtonText | Input | Text shown on the secondary button. |
bShowSecondButton | Input | Controls whether the second button is shown. |
Then | Output | Continues immediately after the async action is created. |
On First Button | Output | Fires when the primary button is chosen. |
On Second Button | Output | Fires when the secondary button is chosen or the dialog is canceled. |
#include "MessageBoxWindows.h"
UFUNCTION()
void HandlePrimaryDialogButton();
UFUNCTION()
void HandleSecondaryDialogButton();
UAsyncRegularMessageBoxAction* Action =
UAsyncRegularMessageBoxAction::ShowMessageBoxAsync(
this,
TEXT("Install"),
TEXT("Start installation now?"),
EWNTMessageBoxIcon::Information,
TEXT("Start"),
TEXT("Later"),
true);
Action->OnFirstButton.AddDynamic(this, &UMyObject::HandlePrimaryDialogButton);
Action->OnSecondButton.AddDynamic(this, &UMyObject::HandleSecondaryDialogButton);Last updated on