Entity
In one line: one instance of an archetype, identified by a 64-bit
EntityId.
Entities are created with tx.Spawn<Unit>(…) (which returns an EntityId) and removed with Destroy(id) — both transactional in all storage modes. To read or write an entity you open it inside a transaction: tx.Open(id) returns a read EntityRef, tx.OpenMut(id) a writable one. From an EntityRef you call Read<T> / Write<T> with a component's Comp<T> handle.
An EntityId is a compact value you can store and pass around; a typed cross-entity reference is an EntityLink<T>.
How it relates
- Archetype — an entity's shape; you spawn an archetype.
- Component — what you read/write through the entity's
EntityRef. - Transaction — the scope in which an entity is opened; reads see its snapshot.
- EntityLink — a typed, stored reference from one entity to another.
In the API
EntityId— the 64-bit identity returned bySpawn.EntityRef— the handle fromOpen/OpenMut;Read<T>/Write<T>.
Learn & use
- Narrative: Guide ch.1 — spawn, read, query
- Feature detail: component collections