Unity Ecs Patterns

Unity Ecs Patterns

Teaches an AI agent Unity's data-oriented stack: ECS, the Job System and Burst, for high-entity-count games, with performance best practices.

Skill files2 files

references/

SKILL.md63 lines
1
---
2
name: unity-ecs-patterns
3
description: Master Unity ECS (Entity Component System) with DOTS, Jobs, and Burst for high-performance game development. Use when building data-oriented games, optimizing performance, or working with large entity counts.
4
---
5
6
# Unity ECS Patterns
7
8
Production patterns for Unity's Data-Oriented Technology Stack (DOTS) including Entity Component System, Job System, and Burst Compiler.
9
10
## When to Use This Skill
11
12
- Building high-performance Unity games
13
- Managing thousands of entities efficiently
14
- Implementing data-oriented game systems
15
- Optimizing CPU-bound game logic
16
- Converting OOP game code to ECS
17
- Using Jobs and Burst for parallelization
18
19
## Core Concepts
20
21
### 1. ECS vs OOP
22
23
| Aspect | Traditional OOP | ECS/DOTS |
24
| ----------- | ----------------- | --------------- |
25
| Data layout | Object-oriented | Data-oriented |
26
| Memory | Scattered | Contiguous |
27
| Processing | Per-object | Batched |
28
| Scaling | Poor with count | Linear scaling |
29
| Best for | Complex behaviors | Mass simulation |
30
31
### 2. DOTS Components
32
33
```
34
Entity: Lightweight ID (no data)
35
Component: Pure data (no behavior)
36
System: Logic that processes components
37
World: Container for entities
38
Archetype: Unique combination of components
39
Chunk: Memory block for same-archetype entities
40
```
41
42
## Detailed patterns and worked examples
43
44
Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
45
46
## Best Practices
47
48
### Do's
49
50
- **Use ISystem over SystemBase** - Better performance
51
- **Burst compile everything** - Massive speedup
52
- **Batch structural changes** - Use ECB
53
- **Profile with Profiler** - Identify bottlenecks
54
- **Use Aspects** - Clean component grouping
55
56
### Don'ts
57
58
- **Don't use managed types** - Breaks Burst
59
- **Don't structural change in jobs** - Use ECB
60
- **Don't over-architect** - Start simple
61
- **Don't ignore chunk utilization** - Group similar entities
62
- **Don't forget disposal** - Native collections leak
63

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…