Enum ScheduleGranularity
Describes how the entities that match an EntityQuery
should be distributed when a job is scheduled to
run on multiple worker threads using ScheduleParallel()
. In most cases, Chunk
should be used.
Namespace: Unity.Entities
Syntax
public enum ScheduleGranularity
Fields
Name | Description | Value |
---|---|---|
Chunk | Entities are distributed to worker threads at the granularity of entire chunks. This is generally the safest and highest-performance approach, and is the default mode unless otherwise specified. The entities within the chunk can be processed in a a cache-friendly manner, and job queue contention is minimized. |
|
Entity | Entities are distributed to worker threads individually. This increases scheduling overhead and eliminates the cache-friendly benefits of chunk-level processing. However, it can lead to better load-balancing in cases where the number of entities being processed is relatively low, and the cost of processing each entity is high, as it allows the entities within a chunk to be distributed evenly across available worker threads. |