Will I get better performance from one component or lots of components

Will having one ActorComponent holding all abilities and movement and stats be slower then a separate component for abilities and stats and movement

When calling a function from component does it go through everything or directly to the function

I was concerned having lots of includes for all the components would slow things down

Will having one component with thousands of lines of functions be slower then lots of little components

Having lots of includes have no runtime performance implications.
Most performance implication of having multiple components comes from having to call virtual functions like Tick that engine has to find and call every frame.
But if its data only components like abilities, stats and moments, you can create multiple components and disable their tick (if they aren’t doing anything in tick).
Setting bCanEverTick to false means that that component can never tick, so UE4 will optimize this by removing that component from it’s list of objects that will tick.
The same optimization works for actors too. Disable tick for any actor in your game that doesn’t use tick can improve your performance.

1 Like

Thank you plato.manchi that was very helpful

Disabling tick for extra performance applies to c++ as well or just for BP actors?

Yeh although you can’t set Can ever tick to false in blueprint, you can set tick enabled to false in blueprint and it does translate to added performance.
You might not see the effects if its actor or component that is spawned only once, but disabling enough ticks, in C++ or in blueprint does adds up

1 Like