docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct ChunkEntityEnumerator

    Helper utility to quickly identify the next available entity or component within a chunk (e.g. the index of the NativeArray_1 retrieved via GetComponentDataPtrRW<T>(ref ComponentTypeHandle<T>) or GetEntityDataPtrRO(EntityTypeHandle))

    Namespace: Unity.Entities
    Assembly: Unity.Entities.dll
    Syntax
    [GenerateTestsForBurstCompatibility]
    public struct ChunkEntityEnumerator

    Constructors

    Name Description
    ChunkEntityEnumerator(bool, v128, int)

    Construct a new instance.

    Methods

    Name 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(out int)

    Iterates through the given ArchetypeChunk, retrieving the index of the next available entity as defined by the mask info provided to the constructor.

    NextEntityIndexBatch(out int, out int)

    Iterates through the given ArchetypeChunk a whole contiguous run of available entities at a time, rather than one index at a time as NextEntityIndex(out int) 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 [0, chunk.Count).

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)