Struct WalkBatch<TArch>
One batch of a ArchetypeWalk<TArch>: up to 64 entities, addressed by slot. Iterate the set bits of Rows; each indexes EntityIds and every span GetReadOnlySpan<T>(Comp<T>) returns.
public readonly ref struct WalkBatch<TArch> where TArch : class
Type Parameters
TArch
- Inherited Members
Remarks
Valid until the walk's next MoveNext or Dispose: using it after throws, and so does any span it handed out read after that point only by
convention — the memory behind it is the walk's or a page the walk let go of. Values are copies the caller may not write through.
Properties
Count
The number of entities in this batch.
public int Count { get; }
Property Value
EntityIds
The raw entity id of every slot; meaningful only at the slots Rows names.
public ReadOnlySpan<long> EntityIds { get; }
Property Value
Rows
One bit per slot holding an entity of this batch. Never zero.
public ulong Rows { get; }
Property Value
Methods
GetEntityId(int)
The id of the entity at slot, a set bit of Rows.
public EntityId GetEntityId(int slot)
Parameters
slotint
Returns
GetReadOnlySpan<T>(Comp<T>)
The values of component comp by slot, as this walk reads them: at the snapshot for a Versioned component, the current value
otherwise.
public ReadOnlySpan<T> GetReadOnlySpan<T>(Comp<T> comp) where T : unmanaged
Parameters
compComp<T>
Returns
- ReadOnlySpan<T>
Type Parameters
T
Exceptions
- InvalidOperationException
The batch's step is over, or
Tdoes not stride the component's column.