How to use GetComponents with TSubclassOf?

Ah! OK, I’m very new to C++ so I think I’ve just stumbled upon a fundamental mistake in my understanding. I didn’t really understand that a subclass still is the parent class as well as being the subclass.

So in order to have an array that holds all the subclass components, I can simply do TArray<UBrushDynamicComponent*>. I don’t even need to use TSubclassOf. So I can simply do:


TArray<UDynamicBrushComponent*> DynamicsArray;

GetComponents<UBrushDynamicComponent>(BrushDynamicsArray);

And it works perfectly. You were right about it needing to be in BeginPlay as well though. I was trying to do the GetComponents() in the constructor.

It works perfectly now. Thank you SO MUCH for helping me out!