docs.unity3d.com
    目次を表示する/隠す

    Namespace Unity.Jobs

    Classes

    EarlyInitHelpers

    Used by automatically generated code. Do not use in projects.

    IJobFilterExtensions

    Extension class for the IJobFilter job type providing custom overloads for scheduling and running.

    IJobParallelForBatchExtensions

    Extension class for the IJobParallelForBatch job type providing custom overloads for scheduling and running.

    IJobParallelForDeferExtensions

    Extension class for the IJobParallelForDefer job type providing custom overloads for scheduling and running.

    RegisterGenericJobTypeAttribute

    When added as an assembly-level attribute, allows creating job reflection data for instances of generic jobs.

    Interfaces

    IJobFilter

    IJobFilter allows for custom jobs to implement a bool Execute(int index) job function used to filter a list of indices. For a provided list and index range, the list will be modified to append all indices for which Execute returns true or to exclude all indices for which Execute returns false depending on if ScheduleAppend or Schedule is used, respectfully, for enqueuing the job with the job system.

    IJobParallelForBatch

    Job type allowing for data to be operated on in parallel batches. When scheduling an IJobParallelForBatch job the number of elements to work on is specied along with a batch size. Jobs will then run in parallel invoking Execute at a particular 'startIndex' of your working set and for a specified 'count' number of elements.

    IJobParallelForDefer

    A replacement for IJobParallelFor when the number of work items is not known at Schedule time. IJobParallelForDefer lets you calculate the number of iterations to perform in a job that must execute before the IJobParallelForDefer job.

    When Scheduling the job's Execute(int index) method will be invoked on multiple worker threads in parallel to each other. Execute(int index) will be executed once for each index from 0 to the provided length. Each iteration must be independent from other iterations (The safety system enforces this rule for you). The indices have no guaranteed order and are executed on multiple cores in parallel. Unity automatically splits the work into chunks of no less than the provided batchSize, and schedules an appropriate number of jobs based on the number of worker threads, the length of the array and the batch size. Batch size should generally be chosen depending on the amount of work performed in the job. A simple job, for example adding a couple of float3 to each other should probably have a batch size of 32 to 128. However if the work performed is very expensive then it is best to use a small batch size, for expensive work a batch size of 1 is totally fine. IJobParallelFor performs work stealing using atomic operations. Batch sizes can be small but they are not for free. The returned JobHandle can be used to ensure that the job has completed. Or it can be passed to other jobs as a dependency, thus ensuring the jobs are executed one after another on the worker threads.

    Delegates

    EarlyInitHelpers.EarlyInitFunction

    Used by automatically generated code. Do not use in projects. Delegate used for early initialization

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)