How to create a new custom delegate use for get a return value in blueprint just like FGetWidget?


I’m creating a search box widget, and I want to make the user can bind a blueprint function with a match rule to check the typed text.

So I should create a delegate with return value to the user can bind a customize blueprint function.

//I defined the delegate.

DECLARE_DYNAMIC_DELEGATE_RetVal_TwoParams(bool, FOnMatchTypedText, const FString&, TypedText, const FString&, Suggestion);

//And create a variable with the delegate.

UPROPERTY(EditAnywhere, Category = Events)
        FOnMatchTypedText    OnMatchTypedText;

But it can’t bind any function in the blueprint.

How do I create a custom delegate with return value like FGetWidget?

Good morning,

I think your are missing the BlueprintAssignable flag like in OnActorBeginOverlap

UPROPERTY(BlueprintAssignable, Category="Collision")
FActorBeginOverlapSignature OnActorBeginOverlap;

I tried it, but if I used it, I’ll get an error like BlueprintAssignable must use for multicast delegate.

That’s the thing. If you want to be able to use the delegate like this in Blueprint it has to be multicast.

I know, but the multicast delegate can’t return a value for me.

I want to get a return value from the delegate.

Like MenuAnchor’s OnGenerateContent delegate.