Call Blueprint function from C++ and get the return value

I’m pretty sure you also need to destroy the value in the container afterwards. For reference see CallFunctionByNameWithArguments.

FName Result = OutProp->GetPropertyValue_InContainer(FuncParam.GetStructMemory());

// From CallFunctionByNameWithArguments:
//!!destructframe see also UObject::ProcessEvent
for (TFieldIterator<FProperty> It(Function); It && It->HasAnyPropertyFlags(CPF_Parm); ++It)
{
	It->DestroyValue_InContainer(FuncParam.GetStructMemory());
}

return Result;
1 Like