Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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:

    Code:
    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?

    #2
    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"

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

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

    Comment


      #3
      I'm pretty sure you can just use the 'bind' node.

      Comment

      Working...
      X