How do I make a function delegate parameter optional?

Hello,

I have a function with a Delegate (by ref) (or Event reference) Parameter which connects to a ‘Bind Event to’ node, but if I leave this input node blank, it does not allow me to compile the code and produces an error saying that it needs to have some sort of input.

How can I make it, so that it allows me to leave it blank? Is there a way to check if the input contains anything?

Make the delegate a const reference in the function declaration and then use the UFUNCTION meta property AutoCreateRefTerm like so:

DECLARE_DYNAMIC_DELEGATE(FLoadingComplete);

UFUNCTION(BlueprintCallable, meta = (AutoCreateRefTerm = "OnComplete"))
void ShowLoadingScreen(const FLoadingComplete& OnComplete);

Thanks! But this is a Blueprint Scripting question. Is it possible to do that in blueprints?

I was not aware that it was even possible to use a delegate as a parameter using blueprints only. The only way I managed to do it was by collapsing a Bind Event to... node. This makes me think that it wasn’t really an intended feature.

The C++ code above will create a function that is usable in Blueprint, if that’s an option for you.

Ah alright, thanks for the help! :slight_smile: