I want to bind a function to this event. (GetWorld()->GameStateSetEvent)
I want to do it in the controller and I also want to do it in the widgets.
However I can’t find the correct event to bind it.
Sometimes it works and sometimes it fails.
So knowing the right place where it never fails would be great.
Thank you so much!!
UPDATE:
This does not work because sometimes the widget is created after the GameState… so it never know it happened.
And in the player controller maybe this could be a good place but i’m not complely sure…
void AMyPlayerController::ReceivedPlayer()
{
Super::ReceivedPlayer();
UWorld* World = GetWorld();
if (!IsValid(World))return;
World->GameStateSetEvent.AddUObject(this,
&AMyPlayerController::HandleGameStateSet);
}