Download

How to check is preperty type int or FString

How can I check is property type int or FString
something like c# (propertyType== typeof(int)),
I tried IsChildOf, it is fine with AActors, but how to be with simple types?



for (TFieldIterator<UProperty> PropIt(GetClass()); PropIt; ++PropIt)
{
	UProperty* property = *PropIt;
	UClass* propertyType = property->GetClass();
	
	if (propertyType->IsChildOf(AActor::StaticClass())) {} 
        // check is int
        // check is FString
}

StrProperty::StaticClass() and IntProperty::StaticClass() don’t work

Maybe try a cast to UNumericProperty in the loop.

https://docs.unrealengine.com/latest/INT/API/Runtime/CoreUObject/UObject/UNumericProperty/index.html

If you look at Engine source code, specifically function FDataTableExporterJSON::WriteStructEntry, you’ll see how Epic does it.