Function ecs_is_valid

Synopsis

#include <include/flecs.h>

FLECS_API bool ecs_is_valid(const ecs_world_t *world, ecs_entity_t e)

Description

Test whether an entity is valid. Entities that are valid can be used with API functions.

An entity is valid if it is not 0 and if it is alive. If the provided id has a role or a pair, the contents of the role or the pair will be checked for validity.

is_valid will return true for ids that don't exist (alive or not alive). This allows for using ids that have never been created by ecs_new or similar. In this the function differs from ecs_is_alive, which will return false for entities that do not yet exist.

The operation will return false for an id that exists and is not alive, as using this id with an API operation would cause it to assert.

Parameters

world - The world.

e - The entity.

Returns
True if the entity is valid, false if the entity is not valid.

Source

Line 1752 in include/flecs.h.