C++ How do I store a class type as a value

Hello, new to the Unreal API but I’ve been working with it for a little while now. I’m familiar with C++ so I was wondering how I would go about storing classes of UClass objects as values in order to make use of them at a later time?

For example storing various AActor derived classes into a dynamic array and spawning them later and getting the correct type for their class. I notice in the Blueprints visual scripting I can store class types as values so I was wondering how to achieve the same thing in C++? And would it be possible to expose this value as a UProperty for use in Blueprint scripting?

You can use TSubClassOf to store any child class and blueprint class.

1 Like

Thanks, I’ll try that out soon.

Small error. Should be TSubclassOf not TSubClassOf.