How to iterate UClasses?

I want to iterate through all UClasses with a specific parent but I’m not sure how. I need to check their properties for something I’m making these classes will not always exist as objects in the world. How can I get a list of UClasses without their corresponding classes being created?

I’ve tried passing the Name of the parent class in GetAssetsByClass on the AssetRegistry module…but it returns nothing and I tried creating an ObjectLibrary, both don’t work :(. I figured AssetRegistry would work as it looks like how it gets the class list back in the editor when you create blueprints, but I can’t find any C++ classes using this method.

I have same exact problem. I can get all assets, no problem. But I can’t get an array of specific objects using GetAssetsByClass, I always get an empty container.

Simply do:


for (TObjectIterator<UClass> It; It; ++It)
{
      // Whatever ...
}

Don’t forget to include :


#include "EngineUtils.h"

1 Like

Note that TObjectIterator only works for loaded objects. Any UObjects (and by extension, UClasses) that are not loaded will not be part of the iterator.

1 Like