Expand description
Entity handling types.
In Bevy ECS, there is no monolithic data structure for an entity. Instead, the Entity
struct
is just a generational index (a combination of an ID and a generation). Then,
the Entity
maps to the specific Component
s. This way,
entities can have meaningful data attached to it. This is a fundamental design choice
that has been taken to enhance performance and usability.
Usage
Here are links to the methods used to perform common operations involving entities:
- Spawning an empty entity: use
Commands::spawn
. - Spawning an entity with components: use
Commands::spawn_bundle
. - Despawning an entity: use
EntityCommands::despawn
. - Inserting a component to an entity: use
EntityCommands::insert
. - Adding multiple components to an entity: use
EntityCommands::insert_bundle
. - Removing a component to an entity: use
EntityCommands::remove
.
Structs
Lightweight unique ID of an entity.
A location of an entity in an archetype.
An Iterator
returning a sequence of Entity
values from
Entities::reserve_entities
.