Unity Ecs Patterns
Seth HobsonCommunityCreated by Seth Hobson
- Skill
- Guidelines
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured reference for implementing high-performance game logic using Unity's Entity Component System (ECS), Job System, and Burst Compiler. It contrasts traditional object-oriented programming with data-oriented design, offering patterns for component definition, system implementation using ISystem, entity querying, and managing structural changes via Entity Command Buffers. It emphasizes performance optimization through contiguous memory layout and parallel processing.
What it does
- Defines patterns for ECS components, including data, tags, buffers, and shared components.
- Provides templates for high-performance systems using ISystem and Burst compilation.
- Demonstrates efficient entity querying and filtering techniques.
- Outlines best practices for structural changes using Entity Command Buffers.
- Offers guidance on transitioning from object-oriented to data-oriented architectures.
- Highlights performance pitfalls like managed types and improper chunk utilization.
When to use it
- When developing high-performance Unity games requiring mass simulation.
- When managing thousands of entities that exceed standard object-oriented scaling.
- When optimizing CPU-bound game logic for parallel execution.
- When implementing data-oriented systems to improve memory cache efficiency.
Advantages
- Promotes linear scaling for large entity counts.
- Leverages Burst compiler for significant CPU performance gains.
- Encourages clean, modular code through ISystem and Aspects.
- Reduces memory fragmentation by utilizing contiguous data storage.
Usage examples
- “How do I create a basic data component in Unity ECS?”
- The skill provides a struct definition implementing IComponentData, ensuring it contains only pure data without methods.
- “What is the recommended way to implement a system in DOTS?”
- It suggests using ISystem over SystemBase for better performance and full Burst compatibility.
- “How can I safely destroy entities during a system update?”
- It explains the use of Entity Command Buffers (ECB) to defer structural changes like entity destruction.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/wshobson/unity-ecs-patterns/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip unity-ecs-patterns.zip -d .agents/skills
Documentation by Seth Hobson
Unity ECS Patterns
Production patterns for Unity's Data-Oriented Technology Stack (DOTS) including Entity Component System, Job System, and Burst Compiler.
When to Use This Skill
Building high-performance Unity games
Managing thousands of entities efficiently
Implementing data-oriented game systems
Optimizing CPU-bound game logic
Converting OOP game code to ECS
Using Jobs and Burst for parallelization
Core Concepts
1. ECS vs OOP
| Aspect | Traditional OOP | ECS/DOTS |
|---|---|---|
| Data layout | Object-oriented | Data-oriented |
| Memory | Scattered | Contiguous |
| Processing | Per-object | Batched |
| Scaling | Poor with count | Linear scaling |
| Best for | Complex behaviors | Mass simulation |
2. DOTS Components
Entity: Lightweight ID (no data)
Component: Pure data (no behavior)
System: Logic that processes components
World: Container for entities
Archetype: Unique combination of components
Chunk: Memory block for same-archetype entitiesDetailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
Do's
Use ISystem over SystemBase - Better performance
Burst compile everything - Massive speedup
Batch structural changes - Use ECB
Profile with Profiler - Identify bottlenecks
Use Aspects - Clean component grouping
Don'ts
Don't use managed types - Breaks Burst
Don't structural change in jobs - Use ECB
Don't over-architect - Start simple
Don't ignore chunk utilization - Group similar entities
Don't forget disposal - Native collections leak
Files
- ATTRIBUTION.mdAdded by AutoGineer986 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md2.0 KiB
- references/details.md14.1 KiB
LICENSE
MIT License Copyright (c) 2024 Seth Hobson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Seth Hobson
- Publisher
- Seth Hobson (Community)
- Source
- wshobson/agents · plugins/game-development/skills/unity-ecs-patterns · commit 4bde316
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Seth Hobson.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download unity-ecs-patterns.zip