c++unreal-engine4unreal-umg

How to pass value to or call a function of AMyPlayerController (APlayerController) from UMenuWidget (UUserWidget) in Unreal, using C++?


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.
This prevents me from add/bind-ing of functions.

How can I do/solve this?

Kindly help me, please.
Thank you.


Solution

  • Link to answer, at UE4 Answer Hub:
    https://answers.unrealengine.com/questions/1056641/how-to-pass-value-to-or-call-a-function-of-amyplay.html