Function ecs_bulk_init


#include <include/flecs.h>

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


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.


world - The world.

desc - Bulk creation parameters.

Array with the list of entity ids created/populated.


Line 1639 in include/flecs.h.