ChunkEntityEnumerator
Helper utility to quickly identify the next available entity or component within a chunk (e.g. the index of the NativeArray<T> retrieved via ArchetypeChunk.GetComponentDataPtrRW or ArchetypeChunk.GetEntityDataPtrRO )
Read time 1 minuteLast updated a day ago
Definition
- Type: Struct
- Namespace: Unity.Entities
- Assembly: UnityEngine.EntitiesModule
public struct ChunkEntityEnumerator
Constructors
Constructor | Description |
|---|---|
| ChunkEntityEnumerator(System.Boolean,Unity.Burst.Intrinsics.v128,System.Int32) | Construct a new instance. |
Methods
Method | Description |
|---|---|
| IsSparse | Returns whether the available entities are not a single contiguous run starting at slot 0 (i.e. there are gaps between available entities). A fully-available chunk returns false. Does not consume any entities, so it may be called before iterating. |
| NextEntityIndex | Iterates through the given ArchetypeChunk, retrieving the index of the next available entity as defined by the mask info provided to the constructor. |
| NextEntityIndexBatch | Iterates through the given ArchetypeChunk a whole contiguous run of available entities at a time, rather than one index at a time as ChunkEntityEnumerator.NextEntityIndex does. A run is a set of adjacent slots that are all available; batching lets a caller process a dense span in one operation. When every entity is available (the common case) this yields a single run |