How to pass value to or call a function of AMyPlayerController (APlayerController) from UMenuWidget (UUserWidget)?

Hi.

My UMenuWidget (derived from UUserWidget) needs to pass a value to AMyPlayerController (derived from APlayerController).

I have tried DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FPassParam,int,intData);; but inGameHUD->MenuWidget from AMyPlayerController::BeginPlay() returns NULL, likely because MenuWidget is yet to be created.

How can I do/solve this?

Kindly help me, please.
Thank you.

If you’re using a delegate, bind to the event when you create the widget, not on begin play. Or you can use GetOwningPlayer() in your widget to get hold of the controller. Or as I normally like to do, create a function in the widget, which will set the controller reference, and call it from the controller that creates the widget.

I can get MyPlayerController, but not any of my functions inside it. How can I access them?
They are kept public.

If you get the player controller and successfully cast it to your class, these functions must be available. Are you sure you get the correct controller class? Can you show the code where you actually do that?

I missed the casting. Thanks a lot!