What is the ECS?
The entity component system (ECS) is a new way of writing code in Unity that is better suited to achieving high-performance and highly-parallelized code by default.
Similarly to how we have Game Objects with MonoBehaviours in the classic object model of Unity, in the new ECS we have entities, components and systems:
- Entities: You can think of them as lightweight Game Objects. In fact, under the hood they are only integer identifiers that do not store any data on their own.
- Components: Components can be added to entities, similarly to how MonoBehaviours can be added to Game Objects. Components are where the data of entities is stored.
- Systems: Whereas in the classic Unity object model, both the data and the behavior were defined in MonoBehaviours, in the ECS systems define the behavior of your game. This means that, by design and unlike classic Unity, there is a complete separation between data (components) and logic (systems).