wave6-ecs-state-machine-design

Select ECS state representations for Unity DOTS state machines.

6|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/dyCuong03/unity-agent-team --skill wave6-ecs-state-machine-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wave6-ecs-state-machine-design
Source: https://github.com/dyCuong03/unity-agent-team/tree/main/.claude/skills/unity-dots/wave6-ecs-state-machine-design
Command: npx skills add https://github.com/dyCuong03/unity-agent-team --skill wave6-ecs-state-machine-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you choose an efficient ECS state representation (enum field, IEnableableComponent, or structural add/remove) so your state machine is correct and performant.

Core Features & Use Cases

  • Decision model for state modeling: Selects the best representation based on state count, transition frequency, and whether downstream systems need query-filtering.
  • Performance and cost guidance: Explains tradeoffs, including the relative cost of field writes, enableable bit flips, and structural changes that trigger chunk moves.
  • Practical ECS patterns: Provides senior-level examples for enum FSMs, enableable binary flags, and lifecycle-based structural transitions.

Quick Start

Ask your AI to recommend the ECS state representation for your Unity DOTS state machine given your number of states, expected transition rate, and how other systems query for active states.

Frequently Asked Questions about wave6-ecs-state-machine-design

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

FAQPage Schema
How do I choose an ECS state representation for a Unity DOTS state machine?

To choose an ECS state representation, evaluate your state count, transition frequency, and query-filtering needs. Unity DOTS state machines typically use an enum field, an IEnableableComponent, or structural add/remove patterns based on these performance and correctness factors.

What's the best way to manage binary state transitions in Unity ECS?

The best way to manage binary state transitions in Unity ECS is using an IEnableableComponent. It provides efficient bit flips for state changes and allows downstream systems to easily query-filter by active states without triggering expensive structural changes.

When should I use structural add and remove for Unity DOTS state changes?

Use structural add and remove for Unity DOTS state changes when managing lifecycle-based transitions where entities move between mutually exclusive states. This pattern triggers chunk moves, making it suitable when state changes are infrequent and require strict architectural separation.

Why do structural changes affect performance in Unity ECS state machines?

Structural changes affect performance in Unity ECS state machines because adding or removing components triggers chunk moves. While enum field writes and enableable bit flips are relatively cheap, structural changes incur higher costs when state transition frequency is high.

Can I use an enum field for gameplay AI state logic that other systems need to query?

You can use an enum field for gameplay AI state logic, but it limits query filtering. Downstream systems must read the field value directly rather than filtering through Unity ECS query architecture, making it better for high transition rates with few states.

Does Unity DOTS state machine performance depend on how systems filter by state?

Unity DOTS state machine performance heavily depends on how systems filter by state. IEnableableComponent and structural patterns allow native query filtering, while enum fields require systems to iterate and check values, impacting overall query efficiency.