All functions created in blueprints or using the UFUNCTION annotation are represented in the reflection system as a UFunction
object.
-
You can see how many parameters a UFunction has by looking at
NumParms
-
You can use a TFieldIterator to loop over the function’s properties. This can be used to find its parameter types like below:
UFunction* Function = /* get a function from somewhere */;
for(TFieldIterator<FProperty> It(Function); It && It->HasAnyPropertyFlags(CPF_Parm) && !It->HasAnyPropertyFlags(CPF_OutParm | CPF_ReturnParm); ++It)
{
FProperty* ParamProp = *It;
if(ParamProp->IsA<FBoolProperty>())
{
UE_LOGFMT(LogTemp, Warning, "Func {name} has boolean param {name}", Function->GetName(), ParamProp->NamePrivate);
}
}
The CPF_Parm
flag is set on parameter properties. This includes out parameters, and return values for some reason, which we can filter by checking for CPF_OutParm
and CPF_ReturnParm
.
You can determine the type of the parameter f.ex. via using IsA
or GetClass
.
This info can be used to f.ex. call functions dynamicly