Method ScheduleParallelByRef
ScheduleParallelByRef<T>(ref T, EntityQuery, JobHandle)
Adds an IJobEntityBatchWithIndex instance to the job scheduler queue for parallel execution.
Declaration
public static JobHandle ScheduleParallelByRef<T>(this ref T jobData, EntityQuery query, JobHandle dependsOn = default(JobHandle))
where T : struct, IJobEntityBatchWithIndex
Parameters
Type | Name | Description |
---|---|---|
T | jobData | An IJobEntityBatchWithIndex instance. In this variant, the jobData is passed by reference, which may be necessary for unusually large job structs. |
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. Each chunk can execute in parallel.
ScheduleParallelByRef<T>(ref T, EntityQuery, ScheduleGranularity, NativeArray<Entity>, JobHandle)
Adds an IJobEntityBatchWithIndex instance to the job scheduler queue for parallel execution.
Declaration
public static JobHandle ScheduleParallelByRef<T>(this ref T jobData, EntityQuery query, ScheduleGranularity granularity, NativeArray<Entity> limitToEntityArray, JobHandle dependsOn = default(JobHandle))
where T : struct, IJobEntityBatchWithIndex
Parameters
Type | Name | Description |
---|---|---|
T | jobData | An IJobEntityBatchWithIndex instance. In this variant, the jobData is passed by reference, which may be necessary for unusually large job structs. |
EntityQuery | query | The query selecting chunks with the necessary components. |
ScheduleGranularity | granularity | Specifies the the unit of work that will be processed by each worker thread. If Chunk is passed (the safe default), work is distributed at the level of whole chunks. This can lead to poor load balancing in cases where the number of chunks being processed is low (fewer than the number of available worker threads), and the cost to process each entity is high. In these cases, pass Entity to distribute work at the level of individual entities. |
NativeArray<Entity> | limitToEntityArray | A list of entities to limit execution to. Only entities in the list will be processed. If limitToEntityArray.IsCreated is false (e.g. for a default-initialized array), this filtering is disabled, and the job will process all entities that match the query. |
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 batch found in the entity array. Each batch can execute in parallel.