unity-ecs-patterns

Implements Unity ECS, DOTS, Jobs, and Burst patterns for high-performance game development.

Updated Jun 30, 2026
One-click install
npx skills add https://github.com/kaitoartz/dotfiles --skill unity-ecs-patterns-kaitoartz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: unity-ecs-patterns
Source: https://github.com/kaitoartz/dotfiles/tree/main/dot_gemini/config/skills/unity-ecs-patterns%20-%20Copy
Command: npx skills add https://github.com/kaitoartz/dotfiles --skill unity-ecs-patterns-kaitoartz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing high-performance Unity games that simulate thousands of entities is difficult with traditional object-oriented MonoBehaviour code, which suffers from scattered memory and poor scaling. This Skill provides production-ready patterns for Unity's Data-Oriented Technology Stack (DOTS) so you can build data-oriented systems that scale linearly with entity count. ## Core Features & Use Cases - ECS Architecture Patterns: Define components (IComponentData, IBufferElementData, ISharedComponentData), systems with ISystem, entity queries, and aspects for clean component grouping. - Parallelization & Performance: Use IJobEntity, IJobChunk, IJobParallelFor, Burst compilation, and native collections like NativeParallelMultiHashMap for parallel CPU workloads. - Structural Changes & Baking: Handle entity creation and destruction safely with Entity Command Buffers, and convert GameObjects to entities using Baker classes. - Use Case: Imagine you are building a tower defense game with 10,000 enemies on screen. Use this Skill to convert your OOP enemy logic into Burst-compiled ECS systems with spatial hashing, achieving smooth frame rates that MonoBehaviour code cannot deliver. ## Quick Start Use the unity-ecs-patterns skill to convert my MonoBehaviour enemy movement script into a Burst-compiled ISystem with an IJobEntity job.

Frequently Asked Questions about unity-ecs-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert Unity MonoBehaviour code to ECS?▼

Convert MonoBehaviour code to ECS by creating a Baker class inside an authoring MonoBehaviour that calls AddComponent to attach IComponentData structs to the baked entity. Move per-frame logic into an ISystem implementation that queries components with SystemAPI.Query.

What is the difference between ISystem and SystemBase in Unity ECS?▼

ISystem is an unmanaged struct-based system that is fully Burst-compatible and offers the highest performance, while SystemBase is a managed class that cannot be Burst compiled. The recommended approach is ISystem with [BurstCompile] attributes on lifecycle methods.

How do I create or destroy entities inside a Unity ECS job?▼

Structural changes like creating or destroying entities cannot happen directly inside jobs; use an EntityCommandBuffer obtained from BeginSimulationEntityCommandBufferSystem or EndSimulationEntityCommandBufferSystem. For parallel jobs, use EntityCommandBuffer.ParallelWriter with the entity index in query.

Does Unity Burst compilation work with managed types?▼

No, Burst compilation breaks when using managed types such as classes, strings, or managed arrays inside jobs or ISystem code. Use unmanaged structs, NativeArray, NativeParallelMultiHashMap, and other Unity.Collections types instead.

When should I not use Unity ECS for game development?▼

ECS is not ideal for games with few entities, complex one-off behaviors, or heavy reliance on managed Unity APIs, where traditional OOP MonoBehaviours are simpler. ECS shines in mass simulation scenarios where data-oriented batch processing scales linearly with entity count.