Display message in editor message box?

This can be done in this way:

  1. Create an FNotificationInfo,
  2. Add the notification to the notification manager like this: auto NotificationItem = SlateNotificationManager::Get().AddNotification( Info );,
  3. Set its completion state: NotificationItem->SetCompletionState(SNotificationItem::CS_Success);
  4. Expire and fade out: NotificationItem->ExpireAndFadeout();

Here is an example:

	FNotificationInfo Info( LOCTEXT("HotReloadFinished", "Hot Reload Complete!") );
	Info.Image = FEditorStyle::GetBrush(TEXT("LevelEditor.RecompileGameCode"));
	Info.FadeInDuration = 0.1f;
	Info.FadeOutDuration = 0.5f;
	Info.ExpireDuration = 1.5f;
	Info.bUseThrobber = false;
	Info.bUseSuccessFailIcons = true;
	Info.bUseLargeFont = true;
	Info.bFireAndForget = false;
	Info.bAllowThrottleWhenFrameRateIsLow = false;
	auto NotificationItem = FSlateNotificationManager::Get().AddNotification( Info );
	NotificationItem->SetCompletionState(SNotificationItem::CS_Success);
	NotificationItem->ExpireAndFadeout();

	GEditor->PlayEditorSound(CompileSuccessSound);
2 Likes