How can I make my SNotificationItem work

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 :slight_smile:

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.

1 Like

ah nevermind this actually works well, I was just looking in the wrong place, I was expecting this to show in the main window , instead it showed in the widget I had created. Which makes sense ofc. Ah well I am leaving this here so others can maybe see how to use it.