Many actors vs many components?

Can there be a significant performance difference between using many actors, versus using many actor-components? In my limited experience, there is not. But im not sure.

Hey @somawheels!

So it would depend on the actors and actor components themselves. An actor with many static meshes are better off merged to lower the amount of calls received, however.

They are completely different things with different purposes, so there’s no point in comparing them. The class AActor does a bunch of things which components do not, so you could say that components are more lightweight. ActorComponents are used to re-use logic in actors with different base classes. They are the olives or pineapple on the pizza :slight_smile:

The title of this topic speaks of “components” while the question is about “actor components”. Actor Components, unlike Scene Components, do not contain meshes. There are maybe hundreds of different component types, but you are most likely specifically mentioning that performance optimization with mesh components is possible by using a UInstancedStaticMeshComponent.

Heres an example. I want to attach a movable light to a staticmesh actor. I could just attach a lightComponent to that actor. Or I could create a new actor, attach this to the staticMeshActor, then attach a light to this.

Is this ok, or is it likely to cause problems/waste alot of resources?

It’s probably not going to make that much difference in speed unless you were attaching 1,000 or more lights to an actor - but attaching light actors to your parent actor in theory will be faster than creating light components. I often read from seasoned game developers that reducing the amount of components can be a good optimization (or just using very little from the start).

You could make a test pretty easily too - time/test mem for both ways, that’s always good to do to see real life timings and figures…