View
In one line: a query result you keep and refresh, that reports what changed each time.
Where a one-shot query is a snapshot answer, a view (tx.Query<Unit>()…ToView()) is a result set you hold: Refresh(tx) brings it up to date, GetDelta() returns the Added / Removed / Modified entity keys, and ClearDelta() resets for the next cycle. That delta is exactly what a reactive system or a UI needs.
A view built on an indexed WhereField predicate updates incrementally — the engine moves only the entities that crossed the boundary. A view on a free Where is a pull view, recomputed on Refresh. Same delta either way; the difference is cost. A view is also the input a QuerySystem runs over, and what a subscription publishes to clients.
How it relates
- Query — a view is a query made durable-over-time.
- Index — an indexed predicate makes the view incremental.
- System — a
QuerySystemtakes a view as its input set. - Subscription — publishes a view's deltas to remote clients.
In the API
- EcsView<T> —
Contains/Refresh/GetDelta/ClearDelta, andforeach.
Learn & use
- Narrative: Guide ch.4 §3 — live views
- Feature detail: reactive dispatch & change filters · published views