Function ecs_component_init

Synopsis

#include <include/flecs.h>

FLECS_API ecs_entity_t ecs_component_init(ecs_world_t *world, const ecs_component_desc_t *desc)

Description

Find or create a component. This operation creates a new component, or finds an existing one. The find or create behavior is the same as ecs_entity_init.

When an existing component is found, the size and alignment are verified with the provided values. If the values do not match, the operation will fail.

See the documentation of ecs_component_desc_t for more details.

Parameters

world - The world.

desc - Component init parameters.

Returns
A handle to the new or existing component, or 0 if failed.

Mentioned in

Source

Line 1362 in include/flecs.h.