Dynamic delegate with return value work incorretly


I defined a dynamic delegate with a return value used to get a response from the blueprint.

Just like this:

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

UPROPERTY(EditAnywhere, Category = Events)
FOnMatchTypedText	OnMatchTypedText;

But I can’t bind any function for the delegate in the blueprint.

So, my question is how do i create a delegate used to get a return value from blueprint (just like FGetWidget)?

Try changing your UPROPERTY specifier from

UPROPERTY(EditAnywhere, Category = Events)


UPROPERTY(BlueprintAssignable, Category = Events)

I tried, but it gives me an error.

error : ‘BlueprintAssignable’ is only allowed on multicast delegate properties

I know that is a way to get a return value, but that is not a good way to solve my problem, because I’m creating a widget and i want to the user can bind a custom rule function to do some check.

So I should expose a delegate for the user to customized a match rule just like FGetWidget.

Ah, my mistake. I read your code as a multicast delegate and forgot they can’t return values.

I don’t think there is a direct way to expose these to blueprints, at least not that I’ve come across (although admittedly I’ve not really looked). The way I might solve this is to bind in C++ and use that binding to raise a BlueprintImplementableEvent which contains the return value. Would this work in your case?


DECLARE_DYNAMIC_DELEGATE_ThreeParams(bool, FOnMatchTypedText, const FString&, TypedText, const FString&, Suggestion, bool& ReturnResult);

then bind blueprint function to that delegate using “Create Event” and connect to the UProperty Setter.

You cant create function with ‘return’ in Blueprint. All return values in Blueprint are actually reference params, so DECLARE_DYNAMIC_DELEGATE_RetVa_* are all unuseable. There is an issue tracker for that one actually.