How do I make my C++ events bindable in Blueprint?

I have a component that I pop onto any actor that I want the player to be able to interact with, and give it a delegate that anything else can bind itself to:



DECLARE_EVENT_OneParam(UInteractive, FInteractionEvent, AActor*);

FInteractionEvent InteractedWith;

void UInteractive::Interaction(AActor* callback) {
	InteractedWith.Broadcast(callback);
}

It’s pretty straightforward, but I have been having a heck of a time exposing it in BP- I want to set it up so that I can bind any BP functions to execute when InteractedWith broadcasts, but I can’t find any references to the event in the component’s node; is there some kind of macro I need to be using in my definition?

I’m not sure exactly which one you need, but I’m pretty sure you’ll need one of the macros that expose your C++ to Unreal.

Start on this documentation page “Unreal Architecture”](Programming with CPP in Unreal Engine | Unreal Engine 5.1 Documentation)

Learn about UCLASS(), UFUNCTION(), UPROPERTY(), UINTERFACE(), USTRUCT(), UPARAM()

Somewhere in there is what you need to expose your code to Blueprints.

I’m pretty sure you can just use the ‘bind’ node.