Hi.
I’m trying to get property value but I don’t know how to do it.
That’s what I have right now:
for (TFieldIterator<UProperty> PropIt(Obj->GetClass()); PropIt; ++PropIt)
{
UProperty* Property = *PropIt;
FString type = Property->GetCPPType();
FString name = Property->GetNameCPP();
FString value; // How do I get the property value? I expected something like Property->GetPropertyValue_InContainer(Obj).ToString();
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::White, TEXT(""+type+" "+name+" = "+value));
}
Thanks in advance for help.
**
How it was solved.
**
According to what said. To get the property value you need to access a class instance like UBoolProperty, UNumericProperty etc. I solved it by iterating through appropriate fields like below for bool properties.
void UUPropertiesInformer::ShowBoolProperties(UObject* Object, bool PrintToLogs)
{
// My custom printing method
PrintMessage("SHOWING BOOL PROPERTIES OF " + Object->GetName(), PrintToLogs);
// Iterating through bool properties
for (TFieldIterator<UBoolProperty> Property(Object->GetClass()); Property; ++Property)
{
// "Converting" bool to string
FString value = Property->GetPropertyValue_InContainer(Object) ? "true" : "false";
PrintMessage("bool " + Property->GetNameCPP() + " = " + value, PrintToLogs);
}
}