Function ecs_type_init


#include <include/flecs.h>

FLECS_API ecs_entity_t ecs_type_init(ecs_world_t *world, const ecs_type_desc_t *desc)


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

A type entity is an entity with the EcsType component. This component a pointer to an ecs_type_t, which allows for the creation of named types. Named types are used in a few places, such as for pipelines and filter terms with the EcsAndFrom or EcsOrFrom operators.

When an existing type entity is found, its types are verified with the provided values. If the values do not match, the operation will fail.

See the documentation of ecs_type_desc_t for more details.


world - The world.

desc - Type entity init parameters.

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


Line 1492 in include/flecs.h.