Entity Component System is all you need?

A intro to Game Objects, Components and the Entity Component System in Unity


This article is a sequel to my article on multiple dispatch.

Game Objects and Components

The first time I heard that Unity was building a framework for the Entity Component system. My first reaction was “huh, I thought I was using that already”.

So why ECS

There are 2 purported benefits to the pure ECS approach

  1. Massive scale
Unity Mega Cities Demo

Easier to maintain code

In the ECS system we have 3 things

  1. Components: which hold data
  2. Systems: which process data

Massive scale

When we talk about scale it helps to first identify the bottlenecks.

  1. Intelligently exploit data locality to not have Memory bottleneck your game
A mere 5% utlilization
46% utilization!

Array of Struct vs Struct of Arrays

Unity Game Objects are still object oriented classes that get both data and methods. From a memory standpoint all the data with that Game Object is then spread across the heap instead of holding the data you actually need.


Next steps

Pure ECS is still not the default way to program in Unity so I still think I’ll be using Game Objects for my personal projects which for the most part don’t have millions of entities on screen.


There are tons of references about ECS, they’re all good. My article was meant as an intro that’ll help you explore and enjoy the other references. I’d strongly suggest you check out my favorite references and if you’re still interested check out the rest.

My favorite references

More references

Robots will save us