RelationExtensions.AddRelation_TRelation_(thisEntity,TRelation).md

November 22, 2024 ยท View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS.RelationExtensions

RelationExtensions.AddRelation(this Entity, TRelation) Method

Add the relation with the specified TRelation type to the entity.
Executes in O(1)

public static bool AddRelation<TRelation>(this Friflo.Engine.ECS.Entity entity, in TRelation component)
    where TRelation : struct, Friflo.Engine.ECS.IRelation, System.ValueType, System.ValueType;

Type parameters

TRelation

Parameters

entity Entity

component TRelation

Returns

System.Boolean
true - relation is newly added to the entity.
false - relation is updated.

Exceptions

System.NullReferenceException
If the entity is null.