样式一
//this.cpp
#include "MyActor.h"
#include "Misc/MessageDialog.h"
#include "Logging/LogMacros.h"
// Sets default values
AMyActor::AMyActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
Super::BeginPlay();
FText Title = FText::FromString("My Dialog");
FText Message = FText::FromString("用户名错误");
EAppMsgType::Type Type = EAppMsgType::OkCancel;
EAppReturnType::Type res = FMessageDialog::Open(Type, Message, &Message);
if (res==EAppReturnType::Ok)
{
GEngine->AddOnScreenDebugMessage(0, 1.0f, FColor::Red, "this is testing");