By default, when a non-const reference
is specified in a function, it will be treated by Blueprints as an output parameter:
Show/hide content
UFUNCTION(BlueprintCallable)
static void RemoveDots(FString& String)
{
String.ReplaceInline(TEXT("."), TEXT(" "));
}
There is a macro called UPARAM
which is not widely used, but can control the behavior of parameters specified in UFUNCTIONs.
In particular, it can change the behavior of passing non-const references
by specifying a ref
meta:
Show/hide content
UFUNCTION(BlueprintCallable)
static void RemoveDots(UPARAM(ref) FString& String)
{
String.ReplaceInline(TEXT("."), TEXT(" "));
}
This actually works similarly as specifying “Pass-by-reference” in a Blueprint-only function