Class JobEntityBatchIndexExtensions
Extensions for scheduling and running IJobEntityBatchWithIndex jobs.
Namespace: Unity.Entities
Syntax
public static class JobEntityBatchIndexExtensions
Methods
Run<T>(T, EntityQuery)
Runs the job immediately on the current thread.
Declaration
public static void Run<T>(this T jobData, EntityQuery query)
where T : struct, IJobEntityBatchWithIndex
Parameters
Type | Name | Description |
---|---|---|
T | jobData | An IJobEntityBatchWithIndex instance. |
EntityQuery | query | The query selecting chunks with the necessary components. |
Type Parameters
Name | Description |
---|---|
T | The specific IJobEntityBatchWithIndex implementation type. |
Remarks
This scheduling variant processes each matching chunk as a single batch. All chunks execute sequentially on the current thread.
Schedule<T>(T, EntityQuery, JobHandle)
Adds an IJobEntityBatchWithIndex instance to the job scheduler queue for sequential (non-parallel) execution.
Declaration
public static JobHandle Schedule<T>(this T jobData, EntityQuery query, JobHandle dependsOn = default(JobHandle))
where T : struct, IJobEntityBatchWithIndex
Parameters
Type | Name | Description |
---|---|---|
T | jobData | An IJobEntityBatchWithIndex instance. |
EntityQuery | query | The query selecting chunks with the necessary components. |
JobHandle | dependsOn | The handle identifying already scheduled jobs that could constrain this job. A job that writes to a component cannot run in parallel with other jobs that read or write that component. Jobs that only read the same components can run in parallel. |
Returns
Type | Description |
---|---|
JobHandle | A handle that combines the current Job with previous dependencies identified by the |
Type Parameters
Name | Description |
---|---|
T | The specific IJobEntityBatchWithIndex implementation type. |
Remarks
This scheduling variant processes each matching chunk as a single batch. All chunks execute sequentially.
ScheduleParallel<T>(T, EntityQuery, Int32, JobHandle)
Adds an IJobEntityBatchWithIndex instance to the job scheduler queue for parallel execution.
Declaration
public static JobHandle ScheduleParallel<T>(this T jobData, EntityQuery query, int batchesPerChunk = 1, JobHandle dependsOn = default(JobHandle))
where T : struct, IJobEntityBatchWithIndex
Parameters
Type | Name | Description |
---|---|---|
T | jobData | An IJobEntityBatchWithIndex instance. |
EntityQuery | query | The query selecting chunks with the necessary components. |
Int32 | batchesPerChunk | |
JobHandle | dependsOn | The handle identifying already scheduled jobs that could constrain this job. A job that writes to a component cannot run in parallel with other jobs that read or write that component. Jobs that only read the same components can run in parallel. |
Returns
Type | Description |
---|---|
JobHandle | A handle that combines the current Job with previous dependencies identified by the |
Type Parameters
Name | Description |
---|---|
T | The specific IJobEntityBatchWithIndex implementation type. |
Remarks
This scheduling variant processes each matching chunk as a single batch. Each chunk can execute in parallel. This scheduling method is equivalent to calling Unity.Entities.JobEntityBatchIndexExtensions.ScheduleParallelBatched``1(``0,Unity.Entities.EntityQuery,System.Int32,Unity.Jobs.JobHandle) with the batchesPerChunk parameter set to 1.