ComponentPool Class
Stores all components of a specific type for a single scene-scoped EntityWorld. All access is game-thread-only via EntityWorld; no synchronization is required. Provides ArrayPool-based snapshots for zero-allocation iteration.
internal sealed class ComponentPool<T>
where T : Brine2D.ECS.Component
Type parameters¶
T
The component type.
Inheritance System.Object → ComponentPool\<T>
| Methods | |
|---|---|
| All() | Returns all component entries as a materialized list. Allocates a new list on every call; for hot-path iteration prefer GetTypedSnapshot() + Brine2D.ECS.ComponentPool<>.ReturnTypedSnapshot(System.ValueTuple{System.Int64,@0}[]) directly. |
| GetEntityIdSnapshot() | Creates an ArrayPool snapshot of entity IDs only, for type-erased iteration. MUST call ReturnEntityIdSnapshot(long[]) in a finally block. |
| GetTypedSnapshot() | Creates a strongly-typed ArrayPool snapshot for iteration. Avoids the System.Array boxing round-trip of GetSnapshot. MUST call Brine2D.ECS.ComponentPool<>.ReturnTypedSnapshot(System.ValueTuple{System.Int64,@0}[]) in a finally block. |
| InsertSorted(List<AnimationTransition>, AnimationTransition) | Inserts t into list in stable priority order (lower Priority = evaluated first). Equal-priority transitions are appended after existing ones at the same priority, preserving insertion order within a priority band. |
| ReturnEntityIdSnapshot(long[]) | Returns an entity-ID snapshot to the ArrayPool. MUST be called after GetEntityIdSnapshot() to prevent memory leaks. |