In Blueprints, is adding a component at runtime cheaper than adding it in editor

I have many, many instances of my AI bot in my level… so performance is becoming key.

When the AI bots are dormant, I’d like to keep them super cheap so I’d like them to have few components.
But, when the AI bots become active, I’d like to add certain components, using Blueprints.

My question is this:

Would it be cheaper to add and destroy the component as needed at runtime, or would it be cheaper to add the components in the Editor, and then call activate and deactivate on them at runtime?

Thanks! :slight_smile:

Define cheaper. It is cheaper for RAM to add them at runtime. It is cheaper for CPU to add them on construct (in the editor) since this is done in the loading phase. Honestly you are better off using activate and deactivate.

This specific question is micro-optimization. Look elsewhere for real optimization opportunities, and don’t bother optimizing until you have a finished product. You could be wasting time trying to micro-optimize something that doesn’t need optimization.

Thank you Shohei… this really answered my question.

You are 100% right, premature optimization can be unwise. My situation is a bit unusual, perhaps - the performance of my home-grown AI is likely the key possible project-bender.