Function ecs_enable_id


#include <include/flecs.h>

FLECS_API void ecs_enable_id(ecs_world_t *world, ecs_entity_t entity, ecs_id_t id, bool enable)


Enable or disable component. Enabling or disabling a component does not add or remove a component from an entity, but prevents it from being matched with queries. This operation can be useful when a component must be temporarily disabled without destroying its value. It is also a more performant operation for when an application needs to add/remove components at high frequency, as enabling/disabling is cheaper than a regular add or remove.


world - The world.

entity - The entity.

id - The component.

enable - True to enable the component, false to disable.


Line 1779 in include/flecs.h.