Entities
Entities are ecs_entity_t handles created by a world.
ecs_entity_t entity = ecs_new();ecs::init();auto entity = ecs::entity::create();New entities start alive and have no user components.
For abstract entities, bases, and inherited components, see Inheritance.
Liveness
Section titled “Liveness”Use ecs_is_alive() with entity handles created by the same world:
if (ecs_is_alive(entity)) { /* entity can be used */}if (entity.is_alive()) { // entity can be used}ecs_is_alive() is not a general validator for arbitrary integers. Passing ids
that did not come from the world is not supported.
Destroy Entities
Section titled “Destroy Entities”ecs_kill(entity);entity.kill();Killing an entity removes all of its components, runs remove hooks, removes the entity from its current archetype table, and invalidates the handle.
After ecs_kill(), do not use the old handle with component access functions.
Handle Layout
Section titled “Handle Layout”The public API treats ecs_entity_t as an opaque handle. Internally, SIECS packs
an entity index and generation into a 64-bit value so stale handles can be
detected.