Suppose a survival game must move many enemies toward the center of its board. An entity component system (ECS) organizes this work by separating entity identities, gameplay data, and the logic that processes that data. It is a way to implement data-oriented design, not a prerequisite for it. section 1.5 section 12.3
In a simple array-based enemy-movement example, the three parts correspond to:
- Entity: the index identifying which enemy’s data to access. section 12.3
- Component: the array holding enemy positions. section 12.3
- System: the calculation that updates those positions. section 12.3
Listing 12.10 Original enemy movement before DOTS
static void moveEnemies(GameData gameData, Balance balance, float dt)
{
for (int i = 0; i < balance.NumEnemies; i++)
{
Vector2 dir = -gameData.EnemyPosition[i].normalized;
gameData.EnemyPosition[i] = gameData.EnemyPosition[i] +
dir * balance.EnemyVelocity * dt;
}
}The loop demonstrates the array-based analogy, not an ECS implementation: each index selects a position, and one static function updates the positions. Keeping the data together supports cache-friendly access without requiring an ECS conversion. section 12.3 section 12.5
Unity ECS formalizes cache-friendly entity-data storage, but adopting it means creating components for data and systems for calculations. It also works with entities rather than GameObjects, so converting an existing GameObject-based game adds work. Start with the performance problem: arrays and static logic may already provide the needed data locality. Burst, Jobs, and TransformAccessArray are separate Unity DOTS options that can be added selectively; none makes ECS mandatory. section 12.3 section 1.5

