Whether the event stays bound?

blAddddDe
Sun, 23 Jun 2024 00:39:20 +0000
C++

Hi all, I’m wondering if I need OnNotificationStopDisplay.RemoveDynamic(...) or or it will remove the binding itself. Here’s the Code:

void UHUDWidgetBase::TryToInvokeNotification()
{
	if(CurrentNotification) return;
	if(WidgetQueue.Num() == 0) return;

	CurrentNotification = WidgetQueue[0];
	CurrentNotification->NotificationDisplay();
	WidgetQueue.RemoveAt(0);

	CurrentNotification->OnNotificationStopDisplay.AddDynamic(this, &UHUDWidgetBase::TryToInvokeNotification);
	CurrentNotification = nullptr;
}

I’m confused at this point:

CurrentNotification->OnNotificationStopDisplay.AddDynamic(this, &UHUDWidgetBase::TryToInvokeNotification);
	CurrentNotification = nullptr;

Please Help

4 posts - 3 participants