Scripting API
Scripting API
ChunkCollection
Struct in Abyss.Core, from Abyss.Core.
The chunks a ChunkCollection.Query resolved to. Enumerate with foreach.
public readonly ref struct ChunkCollectionRemarks
This is a ref struct so the compiler forbids storing it in a field, boxing it, or capturing it in a closure. That is deliberate: the pointers inside are valid only until the next resolve or the next structural change, and the type system is the cheapest place to stop them outliving that.
Properties
Length
public int Length { get; }Number of chunks. One per Bevy table matching the query.
EntityCount
public int EntityCount { get; }Total entities across every chunk.
Indexers
this[]
public Chunk this[int index] { get; }Gets one chunk by index.
Parameters
index
Methods
GetEnumerator
public ChunkCollection.Enumerator GetEnumerator()Returns an enumerator over the chunks.
Dispose
public void Dispose()Releases the borrows the resolve took, when borrow checking is on.
using var chunks = query.Resolve(); is the documented pattern, and the reason this type has a Dispose at all: a borrow has to end somewhere, and the end of the scope that holds the spans is the only place that is both correct and obvious.
Code running inside a registered system does not need this — the system's borrows are scoped around its whole run, which is the same granularity the scheduler reasons in.
