Function ecs_bulk_init

Synopsis

#include <include/flecs.h>

FLECS_API const ecs_entity_t * ecs_bulk_init(ecs_world_t *world, const ecs_bulk_desc_t *desc)

Description

Bulk create/populate new entities. This operation bulk inserts a list of new or predefined entities into a single table.

The operation does not take ownership of component arrays provided by the application. Components that are non-trivially copyable will be moved into the storage.

The operation will emit OnAdd events for each added id, and OnSet events for each component that has been set.

If no entity ids are provided by the application, the returned array of ids points to an internal datastructure which changes when new entities are created/deleted.

If as a result of the operation triggers are invoked that deletes entities and no entity ids were provided by the application, the returned array of identifiers may be incorrect. To avoid this problem, an application can first call ecs_bulk_init to create empty entities, copy the array to one that is owned by the application, and then use this array to populate the entities.

Parameters

world. - The world.

desc - Bulk creation parameters.

Returns
Array with the list of entity ids created/populated.

Source

Line 1344 in include/flecs.h.