EntityRelations_TRelation_.md

December 3, 2024 ยท View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS

EntityRelations Struct

Storage for all entity relations of the specified TRelation type.
An instance is returned via EntityRelations<TRelation>(this EntityStore).

public readonly struct EntityRelations<TRelation>
    where TRelation : struct, Friflo.Engine.ECS.IRelation, System.ValueType, System.ValueType

Type parameters

TRelation

Properties
EntitiesReturns a collection of entities having one or more relation.
Executes in O(1).
PairsReturn all entity relations as pairs. A pair is (entities[i], relations[i])
Executes in O(1). Most efficient way to iterate all entity relations.
Methods
For(ForEachEntity<TRelation>)Iterates all entity relations.
Executes in O(N) N: number of all entity relations.