
How to Spawn 100,000 Entities in Unity DOTS
June 5, 2026
Garbage Collection in Unity: How Memory Management Works and How to Avoid GC Spikes
June 16, 2026When Unity introduced the Data Oriented Technology Stack (DOTS), many developers started asking the same question: Is ECS really faster than traditional GameObjects?
The short answer is yes — but the real story is more interesting. ECS is not just a faster version of GameObjects. It is a completely different architecture designed to handle large amounts of data efficiently.
In this article, we will compare Unity ECS and traditional GameObjects by running a simple performance test that spawns thousands of moving objects.
By the end of this guide, you will understand when ECS provides a huge performance boost and when the traditional Unity workflow is still the better choice.
Understanding the Core Difference
Traditional Unity development uses an object-oriented architecture. Every object in the scene is a GameObject with multiple components attached to it.
Each component contains both data and behavior. Scripts inherit from MonoBehaviour and run logic inside Update loops.
While this approach is very flexible and easy to use, it does not scale well when the number of objects grows very large.
ECS uses a data-oriented design. Instead of storing logic inside objects, ECS separates data and behavior into three parts:
- Entities
- Components
- Systems
This architecture allows Unity to process large batches of data much more efficiently.
The Performance Test Setup
To compare ECS and GameObjects, we will run a simple test where thousands of objects move forward every frame.
The test will measure how both approaches behave when spawning large numbers of objects.
The test conditions are simple:
- Spawn 10,000 moving objects
- Each object moves every frame
- Measure FPS and CPU usage
This type of workload is common in simulations, RTS games, and crowd systems.
GameObject Implementation
First, we create a traditional MonoBehaviour script that moves a GameObject every frame.
using UnityEngine;
public class MoveForward : MonoBehaviour
{
public float speed = 5f;
void Update()
{
transform.position += Vector3.forward * speed * Time.deltaTime;
}
}
Now we create a spawner that generates thousands of GameObjects.
using UnityEngine;
public class Spawner : MonoBehaviour
{
public GameObject prefab;
public int count = 10000;
void Start()
{
for (int i = 0; i < count; i++)
{
Instantiate(prefab, new Vector3(i % 100, 0, i / 100), Quaternion.identity);
}
}
}
When running this test with thousands of GameObjects, performance begins to drop quickly. The reason is that each object runs its own Update method on the main thread.
ECS Implementation
Now let’s create the same behavior using Unity ECS.
First we define a component that stores movement speed.
using Unity.Entities;
public struct MoveSpeed : IComponentData
{
public float value;
}
Next we create a movement system that processes all entities at once.
using Unity.Entities;
using Unity.Transforms;
using Unity.Mathematics;
public partial struct MovementSystem : ISystem
{
public void OnUpdate(ref SystemState state)
{
float deltaTime = SystemAPI.Time.DeltaTime;
foreach (var (transform, speed) in SystemAPI.Query<RefRW<LocalTransform>, RefRO<MoveSpeed>>())
{
transform.ValueRW.Position += new float3(0,0,1) * speed.ValueRO.value * deltaTime;
}
}
}
Instead of thousands of Update calls, ECS processes all entities in a single system. This dramatically reduces overhead.
Test Results
While exact results depend on hardware and Unity version, the performance difference becomes clear when the number of objects increases.
Typical results look like this:
- 1,000 objects → Both approaches perform well
- 10,000 objects → GameObjects begin slowing down
- 50,000 objects → GameObjects struggle heavily
- 100,000 entities → ECS still performs smoothly
This difference exists because ECS processes memory more efficiently and can distribute work across multiple CPU cores.
Why ECS Scales Better
There are several reasons why ECS performs better with large numbers of objects.
- Contiguous memory layout improves CPU cache efficiency
- Batch processing reduces overhead
- Job System enables multithreading
- Burst compiler generates highly optimized machine code
Together, these optimizations allow ECS to scale far beyond what traditional GameObjects can handle.
When GameObjects Are Still Better
Despite its performance advantages, ECS is not always the right choice.
GameObjects remain ideal for many common game development tasks.
- Small to medium sized games
- Games with complex object hierarchies
- Projects heavily using Unity components like Animator or UI
- Rapid prototyping
For many projects, the simplicity of the GameObject workflow outweighs the performance benefits of ECS.
When ECS Shines
ECS truly shines in scenarios where extremely large numbers of objects must be processed.
- Massive RTS games
- Crowd simulations
- Procedural worlds
- Physics simulations
- Bullet hell games
In these situations, ECS can provide performance improvements that are impossible to achieve with traditional GameObjects.
Conclusion
Unity ECS is not meant to replace GameObjects entirely. Instead, it provides a powerful alternative for situations where performance and scalability are critical.
GameObjects remain excellent for many types of projects, but when dealing with tens or hundreds of thousands of objects, ECS becomes the clear winner.
Understanding both approaches allows developers to choose the right architecture for their specific game.










