The issue is that since the function has no output, attempting to override the function in a blueprint creates an event instead of a function. Using an event for this causes a warning, “No value will be returned by reference. Parameter ‘oBuff’.”
Is there a tag to force a function with no output to be overridden as a blueprint function?
Currently a workaround is to add an output to the c++ declaration, override it in the blueprint as a function, then remove the output parameter.
Good god, yes please. I want to use local variables, so I want my overridden functions to actually be functions. It seems dumb that I have to make an extra function to call into from the overriden event in my BP just so I can have local variables and a clean graph.
I just solved this using Kris’s answer. I just added the && !InFunction->HasMetaData(FName(TEXT(“ForceAsFunction”)) bit and it worked like a charm. This obviously requires source built engine.
bool UEdGraphSchema_K2::FunctionCanBePlacedAsEvent(const UFunction* InFunction)
{
// First check we are override-able, non-static and non-const
if (!InFunction || !CanKismetOverrideFunction(InFunction) || InFunction->HasAnyFunctionFlags(FUNC_Static|FUNC_Const))
{
return false;
}
// Then look to see if we have any output, return, or reference params
return !HasFunctionAnyOutputParameter(InFunction) && !InFunction->HasMetaData(FName(TEXT("ForceAsFunction")));
}