RelationExtensions.GetRelation_TRelation,TKey_(thisEntity,TKey).md

November 22, 2024 ยท View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS.RelationExtensions

RelationExtensions.GetRelation<TRelation,TKey>(this Entity, TKey) Method

Returns the relation of the entity with the given key.
Executes in O(N) N: number of entity relations.

public static ref TRelation GetRelation<TRelation,TKey>(this Friflo.Engine.ECS.Entity entity, TKey key)
    where TRelation : struct, Friflo.Engine.ECS.IRelation<TKey>, System.ValueType, System.ValueType;

Type parameters

TRelation

TKey

Parameters

entity Entity

key TKey

Returns

TRelation

Exceptions

System.Collections.Generic.KeyNotFoundException
The relation is not found at the passed entity.

System.NullReferenceException
If the entity is null.