I have a base class for a component called UBrushDynamicComponent, and various component classes that derive from it.
On my actor class, I want to be able to have an array I can iterate over which contains all of the components on the actor that derive from that class.
In my header file I have the following array set up:
TArray<TSubclassOf<UBrushDynamicComponent>> BrushDynamicsArray;
I want to populate this array with all the attached components that are a subclass of UBrushDynamicComponent. What I’m trying is something like this:
GetComponents<TSubclassOf<UBrushDynamicComponent>>(BrushDynamicsArray);
But it doesn’t work. I’ve been trying loads of things based on the error it throws when trying to build, but I can’t figure it out.
How can I end up with an array of all the components on my actor that derive from a particular class?