Find all subclasses of a certain baseclass?

I have an item-baseclass that is probably going to have a lot(100+) of subclasses. Is there a way to automatically get a reference to every subclass, so that I can spawn a random one out of that list? Or will I have to manually include/add all the subclasses in a spawner class?

Thanks in advance for any help :slight_smile:

Manually create array of subclasses on init, even engine does that:

So it loks like this:

for(TObjectIterator<UClass> It; It; ++It)
	if(It->IsChildOf(USomeAwesomeClass::StaticClass()) && !It->HasAnyClassFlags(CLASS_Abstract))

Thank you very much, that is excatly what I have been searching for. Didn’t know it would be as simple as just running an iterator over UClass, but hey, the simpler the better :slight_smile: