EntityStoreBase.Batch(bool).md

July 25, 2024 ยท View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS.EntityStoreBase

EntityStoreBase.Batch(bool) Method

Returns a CreateEntityBatch used to create entities with components and tags added to the batch.
See Example.

public Friflo.Engine.ECS.CreateEntityBatch Batch(bool autoReturn=true);

Parameters

autoReturn System.Boolean

Returns

CreateEntityBatch

Remarks

The returned batch creates an entity with previously added components and tags when calling CreateEntity().

If autoReturn == true the batch is returned to the EntityStore when calling CreateEntity().
Subsequent use of the batch throws BatchAlreadyReturnedException.

If autoReturn == false CreateEntity() can be called multiple times to create multiple entities.
The caller should call Return() after usage to prevent unnecessary memory allocations.

When calling CreateEntity() or Return() the batch executes without memory allocations.