What problem does it solve?
It avoids slow, error-prone per-entity loops by enabling structural changes across all entities that match an ECS query in a single operation, reducing archetype thrash and eliminating iterator invalidation risks.
Core Features & Use Cases
- One-pass structural changes: Perform operations like destroy, add, remove, or enable/disable components across all entities selected by an
EntityQuery without iterating entities individually.
- Performance-focused query usage: Apply query-level APIs for uniform changes where every matching entity should receive the same outcome.
- Safer ECS patterns: Help prevent runtime exceptions by avoiding query-overload structural changes inside active
SystemAPI.Query foreach loops.
Real-world use case: cleaning up scene entities by destroying a set of matched enemies and removing a “wave complete” component from all remaining wave entities in one frame.
Quick Start
Ask the AI to rewrite your ECS system so it uses state.EntityManager.<Action>(m_Query) with a cached EntityQuery built once during OnCreate, rather than looping over entities and calling per-entity structural methods.