Function ecs_ensure


#include <include/flecs.h>

FLECS_API void ecs_ensure(ecs_world_t *world, ecs_entity_t entity)


Ensure id is alive. This operation ensures that the provided id is alive. This is useful in scenarios where an application has an existing id that has not been created with ecs_new (such as a global constant or an id from a remote application).

When this operation is successful it guarantees that the provided id exists, is valid and is alive.

Before this operation the id must either not be alive or have a generation that is equal to the passed in entity.

If the provided id has a non-zero generation count and the id does not exist in the world, the id will be created with the specified generation.

If the provided id is alive and has a generation count that does not match the provided id, the operation will fail.


world - The world.

entity - The entity id to make alive.


Line 2210 in include/flecs.h.