I am using this code to get/set and int property by name.
bool UMyBPFunctions::SetIntByName(UObject* Target, FName VarName, int in)
{
if (Target)
{
FProperty* property = Target->GetClass()->FindPropertyByName(VarName);
if (!property)
{
return false;
}
FIntProperty* typedProperty = CastField<FIntProperty>(property);
if (!typedProperty)
{
return false;
}
void* propertyAddress = property->ContainerPtrToValuePtr<void>(Target);
typedProperty->SetPropertyValue(propertyAddress, in);
return true;
}
return false;
}
Does anyone know how I can do this for a TArray if integers?