Class JobEntityBatchExtensions | Entities | 0.16.0-preview.21
docs.unity.cn
    Show / Hide Table of Contents

    Class JobEntityBatchExtensions

    Extensions for scheduling and running IJobEntityBatch jobs.

    Inheritance
    Object
    JobEntityBatchExtensions
    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.

    Schedule<T>(T, EntityQuery, JobHandle)

    Adds an IJobEntityBatch 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, 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. All chunks execute sequentially.

    ScheduleParallel<T>(T, EntityQuery, Int32, JobHandle)

    Adds an IJobEntityBatch 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, IJobEntityBatch
    Parameters
    Type Name Description
    T jobData

    An IJobEntityBatch 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 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. This scheduling method is equivalent to calling Unity.Entities.JobEntityBatchExtensions.ScheduleParallelBatched``1(``0,Unity.Entities.EntityQuery,System.Int32,Unity.Jobs.JobHandle) with the batchesPerChunk parameter set to 1.

    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on 30 October 2020