How to find out which components an actor is going to have without spawning?

The title basically sais it all:
I have a UClass of an AActor which I would like to spawn, but only if the class to spawn does not have a certain component. If the class were a C++ class, I could simply get the CDO and run GetComponentsByClass on it, but for classes that are created from Blueprints the CDO does not seem to hold the components that were added in the Blueprint editor.

So, my question is: How can I access the list of components added in the Blueprint Editor with only having the UClass, but not a concrete instance of it?

Hi,

I am having exactly the same issue.

I tried to use GetDefaultObjectSubobjects from UClass but that does only return the subobjects that are specified in c++ code, not those added via Blueprint.

Cheers,
Galtza

If you’re already using/have C++ in your project, then you’ll probably want to use the function provided here:

I’ve not tried it personally, but the code provided by another user logically, in my eyes, checks out at least.

-WM