Generically list Properties of a UObject

Hi,
I am looking for a way to generically list the members (UProperties if needed) of a class. I know I can access them by name with FindPropertyByName, which I think is super usefull. Now I am looking for a way to get the names of the members generically.

I would for example have a TArray with instances of a baseclass in it. I would then iterate over the instances and ask for members of the subclasses. I know that I could achive that with a virutal method (and GetNativePropertyValues is kind of that), I just want to know if there already is something I could use. GetNativePropertyValues kind of fits, but it does more then I want and I’d need to implement that for each subclass, which would be nice to avoid. Although of course not a real problem if I have to. Building on that, I would also like to filter the Properties based on a UProperty modifier.

Greetings, Simon

You can grab and even filter UProperties of a class using TFieldIterator. UField is most lowest reflection system class, which included UFunction, UProperty, UClass etc so you can use it not just for properties but also functions

You can use it like this:

for (TFieldIterator<UProperty> It(UClassPointerOfClassYouWantPropertiesToBeListed); It; ++It) {
     SomeArray->Add(*It)
}

You don’t need to make array you can do somethng with properties stright away

Perfect Answer! Works flawlessly! I did the further filtering like this:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Meta = (ExposeOnSpawn, TEST))

if (it2->HasMetaData(“TEST”))

It really is a joy to programm when everything works as expected (except that dereferencing operator doing type conversion catches me offguard every time :D). Thank you so much!!