Howe to get the Class of a UProperty?

I want to Check the Class of a UProperty’s value.

So For example, I have a actor with a UStaticMeshComponent marked as a UProperty.
I am iterating through all the UProperties on the actor, how can I tell if the UProperty is a UStaticMeshComponent?

You’ll need to cast your FProperty using CastField to FObjectProperty (this cast will fail for non UObject pointer properties). FObjectProperty has a member, PropertyClass, which is the UClass type of the property. With that member you’d call the IsChildOf member function which will tell you if the class is a UStaticMeshComponent (or a child of it). If you’re not worried about child classes like that you can also check against UStaticMeshComponent::StaticClass( ) directly.

1 Like

excellent, thankyou.