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 bare archetype view with no predicate (tx.Query<Unit>().ToView()) is a membership view: it subscribes to the per-archetype spawn/destroy channel and costs O(1) when nothing changed. 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. Subscriptions replicate outward to remote clients from declared projections rather than from a view; the two use separate change-detection paths today — subscriptions use push replication (ctx.Subscriptions.Replicate) rather than the view delta machinery, with a view-based publishing mode planned as a later phase.
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 — replicates engine state to remote clients; publishing a view's members to them is a later phase.
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 · subscriptions