Finding all variables in a category


is there a way to find all variables of a certain category in a (child) Blueprint?

(I’d like to create a simple interface for logging experimental variables to CSV.)

You can use UE4 reflection system . You’ll also need for this to get meta data (uproperty category).

Iterating over properties:

for (TFieldIterator<UProperty> PropIt(GetClass()); PropIt; ++PropIt)
     UProperty* Property = *PropIt;
     // Do something with the property

Getting category of your property for comparison:

UProperty* YourProperty = /* getting reference to your property */;

const FString PropertyCategory = YourProperty->GetMetaData(FName("Category"));

I’m not sure if this code would be allowed to use in packaged game, so you might need to wrap it with this

     <your code for playing with uproperties>

Thanks! It does indeed work nicely with the editor, but not in the packaged game. Without “#if WITH_EDITOR” compilation fails with errors like “‘GetMetaData’: is not a member of ‘UProperty’”. Is there any way to make this work in the packaged game, too?

Edit: One thing I did differently to make it work is the for loop:

for (UProperty* Property = GetClass()->PropertyLink; Property; Property = Property->PropertyLinkNext)

I’ve now worked around the issue simply by ignoring the category and logging all the variables. Apparently everything I need except for the category can be accessed in the packaged build, so an alternative way to filter the variables could be to filter by some prefix in a variable’s name, for example.

were u able to get a struct type variable"s children variable ?