The idea is someone creates a blueprint with some properties and functions that can be called through an external interface. Yes, I know there are already mechanisms to do this, but there are reasons I am doing it differently. So the author of the BP would put functions and variables they want to give access to into the “UI” category. The following code works and compiles just fine for UE5.3, but I am currently working in 5.2 (not my choice), and the line GetMetaData throws a compile error.
In fact, looking up the documentation, it’s not listed as a function available in 5.2 for FProperty (but is for 5.3). But that ignores inheritance… I’m not a great C++ programmer, I’m just getting by (I was over 20 years ago, most of my development since then has been other languages, and C++ has changed dramatically), but isn’t FProperty a subclass of FField? And FField DOES have a GetMetaData function, so I’m not getting what’s wrong.
bool UMyLibrary::GetProperties(UObject* Target, TArray<FString>& properties)
{
bool result = false;
TArray<FString> props;
props.Empty();
for (TFieldIterator<FProperty> prop(Target->GetClass()); prop; ++prop)
{
FString name = prop->GetName();
FString type = prop->GetNameCPP();
FString category = prop->GetMetaData(FName("Category")); // won't work in 5.2
props.Add(name + "," + type + "," + category);
result = true;
} /* */
properties = props;
return result;
}