
Unity ECS Patterns
FreeMaster high-performance game development with Unity ECS.
Free · Opens the source repo
What Unity ECS Patterns does
Unity ECS Patterns provides a comprehensive guide to using Unity's Data-Oriented Technology Stack (DOTS), which includes the Entity Component System (ECS), Job System, and Burst Compiler. This skill is designed for developers looking to build high-performance games that can efficiently manage large numbers of entities. With a focus on data-oriented design, this skill helps you transition from traditional object-oriented programming (OOP) to a more efficient ECS architecture that optimizes memory usage and processing speed.
The skill outlines core concepts of ECS, including the distinction between traditional OOP and ECS, emphasizing the benefits of a data-oriented approach. It details how entities, components, systems, and archetypes work together to create a scalable game architecture. By adopting these patterns, developers can achieve linear scaling with thousands of entities, making it ideal for simulations and games that require high performance.
Included in this skill are best practices that guide developers on effective usage of ECS. It covers essential do's and don'ts, such as the importance of using ISystem for better performance, the advantages of burst compiling, and the necessity of profiling to identify bottlenecks. The skill also warns against common pitfalls like over-architecting and mismanaging memory, ensuring that developers can implement ECS patterns effectively without compromising performance.
For those who are serious about game development in Unity, this skill serves as a valuable resource, providing detailed patterns and worked examples that can be referenced in references/details.md. Whether you're optimizing existing projects or starting new ones, Unity ECS Patterns equips you with the knowledge to leverage the full potential of Unity's DOTS framework.
When to use it
Use this skill when building data-oriented games in Unity, especially when performance and entity management are critical.
When not to use it
This skill may not be suitable for small-scale projects where traditional OOP suffices, or for developers not familiar with Unity's ECS framework.
What you can build with it
Transitioning from OOP to ECS
A developer looking to convert their existing object-oriented game code to ECS can use this skill to understand the fundamental differences and best practices.
Optimizing a CPU-bound game
When facing performance issues in a game with many entities, this skill provides guidelines on how to effectively utilize Jobs and Burst for optimization.
Building a large-scale simulation
For developers creating simulations that require managing thousands of entities, this skill offers the necessary patterns to implement a scalable ECS architecture.
How to install Unity ECS Patterns
View source1. Install with the skills CLI
npx skills add wshobson/agents/unity-ecs-patterns --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by wshobsonUnity 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 entities
Detailed 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
Frequently asked questions about Unity ECS Patterns
Similar skills
Heap Snapshot Analysis
Investigate V8 heap snapshots for memory issues.
VS Code Performance Workflow
Automate performance investigations in VS Code.
Memory Leak Audit
Prevent memory leaks with effective coding patterns.
CPU Profile Analysis
Analyze V8 and Chrome performance profiles for optimization.
Chat Performance Testing
Benchmark and validate chat UI performance in VS Code.
Vercel React Best Practices
Optimize your React and Next.js applications for performance.
