Class JobEntityBatchExtensions
Extensions for scheduling and running IJobEntityBatch jobs.
Namespace: Unity.Entities
Syntax
public static class JobEntityBatchExtensions
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, IJobEntityBatch
Parameters
Type | Name | Description |
---|---|---|
T | jobData | An IJobEntityBatch instance. |
EntityQuery | query | The query selecting chunks with the necessary components. |
Type Parameters
Name | Description |
---|---|
T | The specific IJobEntityBatch implementation type. |
Remarks
This scheduling variant processes each matching chunk as a single batch. All chunks execute sequentially on the current thread.
ScheduleParallel<T>(T, EntityQuery, JobHandle)
Adds an IJobEntityBatch instance to the job scheduler queue for parallel execution.
Declaration
public static JobHandle ScheduleParallel<T>(this T jobData, EntityQuery query, JobHandle dependsOn = default(JobHandle))
where T : struct, IJobEntityBatch
Parameters
Type | Name | Description |
---|---|---|
T | jobData | An IJobEntityBatch 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 IJobEntityBatch 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 ScheduleParallelBatched<T>(T, EntityQuery, Int32, JobHandle) with the batchesPerChunk parameter set to 1.
ScheduleParallelBatched<T>(T, EntityQuery, Int32, JobHandle)
Adds an IJobEntityBatch instance to the job scheduler queue for parallel execution, potentially subdividing chunks into multiple batches.
Declaration
public static JobHandle ScheduleParallelBatched<T>(this T jobData, EntityQuery query, int batchesPerChunk, JobHandle dependsOn = default(JobHandle))
where T : struct, IJobEntityBatch
Parameters
Type | Name | Description |
---|---|---|
T | jobData | An IJobEntityBatch instance. |
EntityQuery | query | The query selecting chunks with the necessary components. |
Int32 | batchesPerChunk | The number of batches to use per chunk. The entities in each chunk matching
|
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 IJobEntityBatch implementation type. |
Remarks
This scheduling variant processes each matching chunk as one or more batches. Each batch, including those from the same chunk, can execute in parallel.
ScheduleSingle<T>(T, EntityQuery, JobHandle)
Adds an IJobEntityBatch instance to the job scheduler queue for sequential (non-parallel) execution.
Declaration
public static JobHandle ScheduleSingle<T>(this T jobData, EntityQuery query, JobHandle dependsOn = default(JobHandle))
where T : struct, IJobEntityBatch
Parameters
Type | Name | Description |
---|---|---|
T | jobData | An IJobEntityBatch 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 IJobEntityBatch implementation type. |
Remarks
This scheduling variant processes each matching chunk as a single batch. All chunks execute sequentially.