Unity
Unity DOTS: Entities Crash Course
Build your first data-oriented entity system in Unity — practical, fast, no fluff
Duration
15 minutes
Skill level
intermediate
Tools needed
Unity 2022.x or later, Entities package (com.unity.entities)
Price
$12
Free preview — Section 1 of 5
Install the Package and Set Up a Real DOTS Sandbox
Start with the right project shape
If you come from classic Unity gameplay code, the biggest DOTS mistake is trying to bolt Entities onto a random MonoBehaviour scene and hoping the mental model just clicks. It usually does not. Give yourself a clean sandbox first.
Use Unity 2022.3 LTS or later. Open Window > Package Manager, switch to the Unity Registry, and install Entities. If the package does not show up cleanly in the UI, use the plus menu and choose Add package by name, then enter com.unity.entities. If you want spawned meshes to actually render in Play mode, add Entities Graphics too. For this course, the only hard requirement is the Entities package, but rendering is a lot nicer when you can see what you spawned.
Next, create a small test scene and add a SubScene. That part matters. Entities data is baked from authoring objects, and a SubScene gives Unity a proper place to convert GameObjects into entity data. Keep the scene tiny: one empty GameObject that will become the spawner, and one prefab that will be instantiated.
The prefab can be as dumb as a cube. This is a programming lesson, not an art pass.
A clean setup checklist:
- One scene with one SubScene.
- One prefab to spawn.
- One authoring GameObject named
Spawnerinside the SubScene. - The Entities Hierarchy window open so you can see what gets baked.
If you prefer editing manifest.json, the package line looks like this:
{
"dependencies": {
"com.unity.entities": "1.0.x"
}
}
One more useful mindset shift before you write any code: GameObjects are authoring-time convenience; entities are runtime data. In a normal Unity workflow, you usually think "this object has scripts on it." In DOTS, think "this entity is just a bag of tightly packed data, and systems operate on matching data." That mental switch is half the battle.
Once the package is installed and your SubScene exists, you are ready to define the data that drives the spawner. Do not start with systems. Start with the component data shape, because in ECS the data model comes first and behavior follows it.
4 more sections unlock after purchase
One-time purchase · Instant access · No subscription
Also in this quest
Define IComponentData and Bake Authoring into an Entity
Write the First ISystem and Spawn with EntityManager
Move Hot Work into a Burst-Compiled IJobEntity
Query Smartly with EntityQuery and Avoid the Usual DOTS Traps