Method Execute
Execute(ArchetypeChunk, Int32, Int32)
Implement the Execute
function to perform a unit of work on an ArchetypeChunk representing
a contiguous batch of entities within a chunk.
Declaration
void Execute(ArchetypeChunk batchInChunk, int batchIndex, int indexOfFirstEntityInQuery)
Parameters
Type | Name | Description |
---|---|---|
ArchetypeChunk | batchInChunk | An object providing access to a batch of entities within a chunk. |
Int32 | batchIndex | The index of the current batch within the list of all batches in all chunks found by the job's EntityQuery. If the batch count is one, this list contains one entry for each selected chunk; if the batch count is two, the list contains two entries per chunk; and so on. Note that batches are not processed in index order, except by chance. |
Int32 | indexOfFirstEntityInQuery | The index of the first entity in the current chunk within the list of all entities in all the chunks found by the Job's EntityQuery. |
Remarks
The chunks selected by the EntityQuery used to schedule the job are the input to your Execute
function. If you use ScheduleParallel<T>(T, EntityQuery, Int32, JobHandle)
to schedule the job, the entities in each matching chunk are partitioned into contiguous batches based on the
batchesInChunk
parameter, and the Execute
function is called once for each batch. When you use one of the
other scheduling or run methods, the Execute
function is called once per matching chunk (in other words, the
batch count is one).