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 |
Re-exports§
pub use hash_map::EntityHashMap;
pub use hash_set::EntityHashSet;
pub use index_map::EntityIndexMap;
pub use index_set::EntityIndexSet;
pub use unique_array::UniqueEntityArray;
pub use unique_array::UniqueEntityEquivalentArray;
pub use unique_slice::UniqueEntityEquivalentSlice;
pub use unique_slice::UniqueEntitySlice;
pub use unique_vec::UniqueEntityEquivalentVec;
pub use unique_vec::UniqueEntityVec;
Modules§
- A wrapper around entity arrays with a uniqueness invariant.
- A wrapper around entity slices with a uniqueness invariant.
- A wrapper around entity
Vec
s with a uniqueness invariant.
Structs§
- Context for component clone handlers.
- A
World
’s internal metadata store on all of its entities. - Lightweight identifier of an entity.
- A configuration determining how to clone entities. This can be built using
EntityCloner::build
, which returns anEntityClonerBuilder
. - A builder for configuring
EntityCloner
. SeeEntityCloner
for more information. - Helper struct that, when printed, will write the appropriate details regarding an entity that did not exist.
- An error that occurs when a specified
Entity
does not exist. - A
BuildHasher
that results in aEntityHasher
. - 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. - A location of an entity in an archetype.
- A wrapper for
EntityHashMap<Entity>
, augmenting it with the ability to allocate newEntity
references in a destination world. These newly allocated references are guaranteed to never point to any living entity in that world. - Provides read access to the source component (the component being cloned) in a
ComponentCloneFn
. - An iterator that yields unique entities.
Traits§
- A trait for types that contain an
Entity
. - A trait for types that represent an
Entity
. - A set of unique entities.
- An iterator over a set of unique entities.
- Conversion from an
EntitySetIterator
. - Operation to map all contained
Entity
fields in a type to new values.