What is better and performance friendly ? or is it the same ?
Putting an actor with several components in the scene (like for example a BP with many static mesh components)
Or place many static mesh actors in the scene one by one.
If you can choose, one actor with N components is more efficient than N actors with one component (root) each.
For example, if you move an actor through the world using SetActorLocation and you have the Sweep option checked, only the root component of the actor is checked for collisions, all the children components are not. They just move along with it.
On the other hand, if you N actors and move them all at once, each root component needs to be checked for collisions, so complexity is O(N) vs. O(1) for the previous case.
A similar reasoning applies to draw calls to the point that UE4 has an Actor Merge function which allows you to merge actors in the editor to reduce complexity and hence limit draw calls.
So, basically, the draw call is running per actor, so if I have an actor with several components (like several mesh components), the draw call will run for all these components at once because they’re part of the same actor.
Is that right ?
In term of performance, we can say roughly that (for example, spawning multiple static meshes) :
High Cost performance -------> Low Cost performance :
Multiple Actors with one component THEN One Actor with several meshes components THEN One actor with several instanced static meshes components THEN One actor with several instanced static meshes components (of already merged meshes)
Is that right ?
Thanks a lot !
Just trying to really understand the subtles differences between actors, components, instances, … these last days !
These are pretty much the general rules. There are always exceptions of course. The best thing to do is to keep monitoring your performance as you develop to make sure you stay within your target FPS. This is especially important if you are developing for example for VR where you need to guarantee you meet strict performance targets.