文档

Unity Engine

Unity Engine

ThreadIndex

Gets the index for the current thread when executing a job, otherwise 0.
阅读时间1 分钟最后更新于 2 个月前

Definition

public static int ThreadIndex { get; }

Remarks

When multiple threads are executing jobs, no two threads have the same index. The range of this property is
[0, Unity.Jobs.LowLevel.Unsafe.JobsUtility.ThreadIndexCount)
. The value returned when used from within a job is the same as the value stored in job members decorated with
[Unity.Collections.LowLevel.Unsafe.NativeSetThreadIndexAttribute]
.
ThreadIndexCount