How would I go about getting a component of an actor that I spawn based on a changing class?

I want to change the physics simulation and collision of a mesh inside an actor object. This works fine as long as I know the specific class of object, but I want to pick a class from an array and then I can’t get access to any components or variables, because I imagine the array can have any kind of class in there and not all of them even have meshes. Now the way I’m thinking I would want to call the mesh component of all my different actors with the same name and tell my blueprint to get the component with that name out of any actor that could be in that spot in the array. But it doesn’t work quite like that, so I could really do with a solution that would produce the kind of result I need without making special cases for every single type of class that it could possibly be.

What is the type of variable Equipment Classes? can you try to set it to class’Actor’ ?

Hey UltraUberPieMan

There is a way to do this in C++. Lets say you make an array of the Components;

TArray Components;
GetComponents(Components);

Then you loop through the array so that;

UPrimitiveComponent* PrimComp = Components[i];

Then you can do what you want to the mesh component by checking;

if (PrimComp->IsA(UstaticMeshComponent::StaticClass())) {
do something}

If you know someone who can do C++ or can do it yourself, this wouldnt be very hard.

It is an array of actor classes. The problem comes from me trying to get a component of the actor I spawned. Because that actor could be pretty much anything, I can’t get a specific component out of it. Even if I try to get something with a specific name.