Function ecs_ensure_id


#include <include/flecs.h>

FLECS_API void ecs_ensure_id(ecs_world_t *world, ecs_id_t id)


Same as ecs_ensure, but for (component) ids. An id can be an entity or pair, and can contain id flags. This operation ensures that the entity (or entities, for a pair) are alive.

When this operation is successful it guarantees that the provided id can be used in operations that accept an id.

Since entities in a pair do not encode their generation ids, this operation will not fail when an entity with non-zero generation count already exists in the world.

This is different from ecs_ensure, which will fail if attempted with an id that has generation 0 and an entity with a non-zero generation is currently alive.


world - The world.

id - The id to make alive.


Line 2233 in include/flecs.h.