Skip to content

CachedEntityQuery Class

Cached query for entities with two components. Cache is rebuilt by iterating the smaller pool and cross-resolving the second component.

public class CachedEntityQuery<T1,T2> : Brine2D.ECS.Query.CachedEntityQueryBase
    where T1 : Brine2D.ECS.Component
    where T2 : Brine2D.ECS.Component

Type parameters

T1

T2

Inheritance System.ObjectCachedEntityQueryBase → CachedEntityQuery\<T1,T2>

Methods
Execute() Executes the query and returns matching entities. The returned list is cached; no allocation occurs per call.
ForEach(Action<Entity,T1,T2>) Executes an action for each cached entity and its components. Automatically parallelizes when entity count exceeds ECSOptions.ParallelEntityThreshold.
GetEnumerator() Returns a struct enumerator over the cached (Entity, C1, C2) tuples. Use with foreach for zero-allocation iteration; no delegate or closure is created.