Hello,
I am trying to use SNotificationItem to create a neat little notification in my editor code.
I searched some existing editor code and it all seems quite simple, except it doesn’t work for me
I have ad editor plugin that is going to be doing some heavy work and during that work I want to display the notification similar to what you can see when we compile the code via hot reload.
so here is my slate class
void SMyDevelopmentHelper::Construct(const FArguments& InArgs)
{
ParentWindowPtr = InArgs._ParentWindow;
ChildSlot
.HAlign(HAlign_Right)
.VAlign(VAlign_Bottom)
.Padding(15)
[
SAssignNew(NotificationListPtr, SNotificationList)
.Visibility(EVisibility::SelfHitTestInvisible)
];
}
I then call a method which is supposed to create a notification
void FMyDevelopmentHelper::OnDoingSomeHeavyComputation(const TSharedRef< SNotificationList >& InNotificationList)
{
FNotificationInfo Info(FText::FromString("A Notification"));
Info.bUseLargeFont = true;
Info.bFireAndForget = true;
Info.bUseSuccessFailIcons = true;
Info.ExpireDuration = 5.0f;
Info.FadeInDuration = 2.0f;
Info.FadeOutDuration = 2.0f;
TSharedPtr<SNotificationItem> Notification = InNotificationList->AddNotification(Info);
if (Notification.IsValid())
{
Notification->SetCompletionState(SNotificationItem::CS_Success);
}
}
I am hoping that someone at Epic can tell me what I am missing to get this code to work.