How to receive broadcast from DECLARE_EVENT_OneParam?

I have got the following chunks of code:

MenuWidget.h

DECLARE_EVENT_OneParam(UMenuWidget,OnClickedButtonOpenEvent,int);
	OnClickedButtonOpenEvent Var;

MenuWidget.cpp

int send {8};
	Var.Broadcast(send);

MyPlayerController.cpp

void AMyPlayerController::nothing2(int x) {
	GEngine->AddOnScreenDebugMessage(
		21,200,FColor::Yellow,FString::Printf(TEXT("nothing2(%d)"),x)
	);
}

How can I receive the event-broadcast here in MyPlayerController.cpp, to be attached to AMyPlayerController::nothing2 ?

I tried:

NOTE: Everything needs to be in C++, no BPs.

1 Like