Version: 2022.2
LanguageEnglish
  • C#

JobsUtility.JobWorkerCount

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static int JobWorkerCount;

Description

Current number of worker threads available to the Unity JobQueue.

By default, this property takes the value of JobWorkerMaximumCount. You can set the value of this property at runtime to dynamically reduce the number worker threads available to the Unity Job Queue. This can have the effect of saving power, or reducing the CPU load on a shared or virtual machine. This is useful if you have multiple instances of a game running as a server, and you want to prevent any single instance from monopolizing the resources of the machine.

You cannot set this value below 0, or above the value of the JobWorkerMaximumCount property. Trying to do so will throw an "out of range" exception.

On some platforms (eg. Android) Unity will automatically adjust this value at runtime in response to the operating system indicating that the number of available cores has changed. This can occur if the device has gone into, or come out of, power-saving mode. However if you set this property manually to any valid value, Unity will stop any automatic adjustment (thus ignoring any requests from the operating system). You can restore the automatic adjustment mode by calling ResetJobWorkerCount.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961