How to Spawn 100,000 Entities in Unity DOTS

Unity DOTS Explained – Understanding Data Oriented Technology Stack
June 5, 2026
Unity ECS vs GameObjects – A Real Performance Comparison
Unity ECS vs GameObjects – A Real Performance Comparison
June 5, 2026
Unity DOTS Explained – Understanding Data Oriented Technology Stack
June 5, 2026
Unity ECS vs GameObjects – A Real Performance Comparison
Unity ECS vs GameObjects – A Real Performance Comparison
June 5, 2026

One of the biggest advantages of Unity DOTS (Data Oriented Technology Stack) is its ability to handle extremely large numbers of objects efficiently. While spawning thousands of GameObjects in traditional Unity can quickly cause performance issues, DOTS allows developers to create and process massive numbers of entities with minimal overhead.

In fact, it is entirely possible to spawn 100,000 entities or more and still maintain excellent performance. This is possible thanks to the combination of Entity Component System (ECS), the Unity Job System, and the Burst Compiler.

In this tutorial, we will walk through how to spawn 100,000 entities using Unity DOTS and explain why this approach is dramatically faster than traditional GameObject workflows.

Why GameObjects Struggle with Large Numbers

In traditional Unity development, every object in the scene is represented by a GameObject. Each GameObject may have multiple components, scripts, and internal engine overhead.

When you try to spawn thousands of GameObjects, several performance problems appear:

  • High memory overhead
  • Slow instantiation
  • Expensive component lookups
  • Heavy main-thread processing

Because GameObjects rely heavily on the main thread, they do not scale well when the number of objects becomes extremely large.

This is exactly the problem DOTS was designed to solve.

Why Entities Are Much Faster

Entities in ECS are very lightweight compared to GameObjects. An entity is essentially just an identifier that references component data stored in memory.

Instead of storing components in scattered memory locations, ECS organizes component data in contiguous memory blocks. This makes memory access much faster and improves CPU cache efficiency.

Because of this design, Unity can process tens or even hundreds of thousands of entities efficiently.

Project Setup

Before creating entities, make sure your Unity project has the required DOTS packages installed.

  • Entities
  • Burst
  • Mathematics
  • Collections

You can install these through the Unity Package Manager.

Creating a Simple Component

First, we need to create a component that will hold the data for our entities. In ECS, components only store data and do not contain behavior.

using Unity.Entities;
using Unity.Mathematics;

public struct MoveSpeed : IComponentData
{
    public float value;
}

This component simply stores the movement speed of an entity.

Creating an Entity Spawner

Next, we will create a system that spawns 100,000 entities. Instead of creating GameObjects, we will use the EntityManager to create entities directly in ECS.

using Unity.Entities;
using Unity.Transforms;
using Unity.Mathematics;

public partial struct EntitySpawnerSystem : ISystem
{
    public void OnCreate(ref SystemState state)
    {
        EntityManager entityManager = state.EntityManager;

        EntityArchetype archetype = entityManager.CreateArchetype(
            typeof(LocalTransform),
            typeof(MoveSpeed)
        );

        int entityCount = 100000;

        NativeArray<Entity> entities = new NativeArray<Entity>(entityCount, Unity.Collections.Allocator.Temp);

        entityManager.CreateEntity(archetype, entities);

        for (int i = 0; i < entityCount; i++)
        {
            float x = i % 500;
            float z = i / 500;

            entityManager.SetComponentData(entities[i], new LocalTransform
            {
                Position = new float3(x, 0, z),
                Rotation = quaternion.identity,
                Scale = 1f
            });

            entityManager.SetComponentData(entities[i], new MoveSpeed
            {
                value = 5f
            });
        }

        entities.Dispose();
    }

    public void OnUpdate(ref SystemState state)
    {

    }
}

Understanding the Entity Archetype

An Entity Archetype defines the structure of an entity. It specifies which components each entity will contain.

In the example above, each entity contains:

  • LocalTransform
  • MoveSpeed

Because all entities share the same structure, Unity can store them very efficiently in memory.

Positioning 100,000 Entities

When spawning large numbers of entities, it is important to distribute them in a logical pattern. In the example above, entities are placed in a grid formation.

This makes it easier to visualize them in the scene and prevents them from spawning on top of each other.

The grid layout is calculated using simple math:

  • The X position is calculated using modulo
  • The Z position is calculated using division

This allows us to create a large grid of entities with minimal calculations.

Moving the Entities with a System

Now that we have spawned 100,000 entities, we can create a system that moves them every frame.

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>>())
        {
            float3 direction = new float3(0, 0, 1);

            transform.ValueRW.Position += direction * speed.ValueRO.value * deltaTime;
        }
    }
}

This system loops through all entities that have both a LocalTransform and MoveSpeed component and moves them forward every frame.

Even with 100,000 entities, this operation remains very efficient because ECS processes data in batches.

Boosting Performance with Burst

To achieve maximum performance, it is recommended to enable the Burst Compiler. Burst compiles your ECS code into highly optimized native machine code.

In many cases, Burst can make systems several times faster than standard managed C# execution.

Most ECS systems automatically benefit from Burst when the package is installed and enabled.

Tips for Handling Massive Numbers of Entities

  • Avoid structural changes every frame
  • Use archetypes efficiently
  • Prefer batch processing
  • Use Burst for heavy calculations
  • Minimize memory allocations

Following these guidelines will help ensure that your ECS systems remain highly performant.

Conclusion

Unity DOTS allows developers to push the limits of what is possible in real-time simulations. While traditional GameObject workflows struggle with thousands of objects, ECS can handle hundreds of thousands of entities with impressive performance.

By combining ECS, the Job System, and the Burst Compiler, developers can build scalable systems capable of powering massive worlds, large crowds, or complex simulations.

Learning how to spawn and manage large numbers of entities is one of the first steps toward mastering high-performance Unity development with DOTS.

Leave a Reply

Your email address will not be published. Required fields are marked *


Skip to toolbar