I Am using this code to get an int property by name.
bool UMyBPFunctions::GetIntByName(UObject* Target, FName VarName, int& out)
{
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);
out = typedProperty->GetPropertyValue(propertyAddress);
return true;
}
return false;
}
Does anyone know how I would do the same for an FString?