Hi guys,
I am writing a class, and I would like to use some UFUNCTIONs in it, which will have default argument values (so that you may or may not specify them, while calling functions from Blueprints). How do I do that? So far, I did not find a single line in engine code or in docs, that explain this optional parameter specifier.
I have tried these versions:
UFUNCTION(BlueprintCallable, Category = Mechanics)
void forceInitItem(uint16 itemLvl = 1);
this throws compilation error from UBT: “C++ Default parameter not parsed: itemLvl "1"”
FUNCTION(BlueprintCallable, Category = Mechanics)
void forceInitItem(optional uint16 itemLvl = 1);
This simply gives error like “unrecognized keyword “optional””
So, what’s the right way?