Return a value from a BlueprintImplementableEvent

I wish to write a function whose implementation is in Blueprint. Further, I would like this function to return a boolean value. I tried to create a BlueprintImplementableEvent that returned a boolean. However, despite no errors from UBT, this did not show up as an event in the BP editor.

UFUNCTION(BlueprintImplementableEvent, Category = Tracking)
bool IsActorInJunction(AActor* Actor);

I also tried changing it to pass in the boolean as a reference, but this also did not generate the event. (Passing in a pointer causes a UBT error).

I have worked around this by having a BP exposed variable which I call an event to set this when I actually want the value. Is there a better way?

1 Like

That looks ideal, I shall try out post haste!

That is much better, thank you. A small thing, but is there no way to have it return result rather than having to pass it in?

The blueprint terminology is somewhat confusing… Events are basically just functions that have no return value (and this is why you can freely use “Delay” nodes in them, by the way). If you add a return type to your BlueprintImplementableEvent signature, it gets converted into a function and appears in a “Functions” menu rather than “Events”. Just override it.

Here is how it looks for me:|

//returns whether popup was created
UFUNCTION(BlueprintImplementableEvent) 
bool ShowTutorialPopup(FGameplayTag Tag, APlayerController* OwnerController);