docs.unity3d.com
    Show / Hide Table of Contents

    Method ScheduleParallel

    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 dependsOn parameter.

    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.

    ScheduleParallel<T>(T, EntityQuery, ScheduleGranularity, NativeArray<Entity>, JobHandle)

    Adds an IJobEntityBatch instance to the job scheduler queue for parallel execution.

    Declaration
    public static JobHandle ScheduleParallel<T>(this T jobData, EntityQuery query, ScheduleGranularity granularity, NativeArray<Entity> limitToEntityArray, 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.

    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 dependsOn parameter.

    Type Parameters
    Name Description
    T

    The specific IJobEntityBatch implementation type.

    Remarks

    This scheduling variant processes each batch found in the entity array. Each batch can execute in parallel.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023