Add OnClick Action C++

Hi Everybody.

How could I add onclick to a button from widget with c++ development ?

Thank you

Hey, here how it would be :

UButton* myBtn;
myBtn->OnClicked.AddDynamic(this, &UMyUObjectClass::MyUFunctionOnClickMethod);

MyUFunctionOnClickMethod should be a UFUNCTION, + void and 0 parameters

AddDynamic is a macro, so it’s not visible in autocomplete sometimes, but it should compile fine ! :slight_smile:
It take a target, and a method to call on the target