Skip to content

EntityId

EntityId = number & object

Defined in: src/entity-id.ts:13

Handle to an entity within the ECS world: a slot index packed with a generation counter. Destroyed entities’ slots are reused with a bumped generation, so a stale handle never resolves to the slot’s new occupant. Read the parts with entityIndex and entityGeneration.

Branded: a plain number is not an EntityId. Ids come from the world (createEntity, spawn, queries, lifecycle events) or from packEntityId; an EntityId still reads as a number anywhere.

readonly [entityIdBrand]: true