Entity.AddComponent_T_(T).md

July 25, 2024 ยท View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS.Entity

Entity.AddComponent(T) Method

Add the given component to the entity.
If the entity contains a component of the same type it is updated.
See Example.

public bool AddComponent<T>(in T component)
    where T : struct, Friflo.Engine.ECS.IComponent, System.ValueType, System.ValueType;

Type parameters

T

Parameters

component T

Returns

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