Expand description
Entity handling types.
An entity exclusively owns zero or more component instances, all of different types, and can dynamically acquire or lose them over its lifetime.
empty entity: Entity with zero components.
pending entity: Entity reserved, but not flushed yet (see Entities::flush docs for reference).
reserved entity: same as pending entity.
invalid entity: pending entity flushed with invalid (see Entities::flush_as_invalid docs for reference).
See Entity to learn more.
§Usage
Operations involving entities and their components are performed either from a system by submitting commands,
or from the outside (or from an exclusive system) by directly using World methods:
| Operation | Command | Method |
|---|---|---|
| Spawn an entity with components | Commands::spawn | World::spawn |
| Spawn an entity without components | Commands::spawn_empty | World::spawn_empty |
| Despawn an entity | EntityCommands::despawn | World::despawn |
| Insert a component, bundle, or tuple of components and bundles to an entity | EntityCommands::insert | EntityWorldMut::insert |
| Remove a component, bundle, or tuple of components and bundles from an entity | EntityCommands::remove | EntityWorldMut::remove |
Structs§
- Entities
- A
World’s internal metadata store on all of its entities. - Entity
- Lightweight identifier of an entity.
- Entity
Hash - A
BuildHasherthat results in aEntityHasher. - Entity
Hasher - A very fast hash that is only designed to work on generational indices
like
Entity. It will panic if attempting to hash a type containing non-u64 fields. - Entity
Location - A location of an entity in an archetype.
- Reserve
Entities Iterator - An
Iteratorreturning a sequence ofEntityvalues from - Scene
Entity Mapper - A wrapper for
EntityHashMap<Entity>, augmenting it with the ability to allocate newEntityreferences in a destination world. These newly allocated references are guaranteed to never point to any living entity in that world.
Traits§
- Entity
Mapper - An implementor of this trait knows how to map an
Entityinto anotherEntity. - MapEntities
- Operation to map all contained
Entityfields in a type to new values.
Type Aliases§
- Entity
Hash Map - A
HashMappre-configured to useEntityHashhashing. - Entity
Hash Set - A
HashSetpre-configured to useEntityHashhashing.