Version: 2022.1

JobsUtility.JobWorkerCount

切换到手册
public static int JobWorkerCount ;

描述

可用于 Unity JobQueue 的当前工作线程数目。

默认情况下,此属性采用 JobWorkerMaximumCount 的值。可在运行时设置此属性的值,以便动态减小可用于 Unity 作业队列的工作线程数。这有节能效果,或者减少共享或虚拟机上的 CPU 负载。如果有作为服务器运行的游戏的多个实例,需要防止任何实例独占机器资源,这将很有用。

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