Entity.AddComponent_T_().md
July 25, 2024 ยท View on GitHub
Friflo.Engine.ECS
Friflo.Engine.ECS.Entity
Entity.AddComponent() Method
Add a component of the given type T to the entity.
See Example.
If the entity contains a component of the same type it is updated.
public bool AddComponent<T>()
where T : struct, Friflo.Engine.ECS.IComponent, System.ValueType, System.ValueType;
Type parameters
T
Returns
System.Boolean
true - component is newly added to the entity.
false - component is updated.
Remarks
Note: Use AddEntityComponent(Entity, ComponentType) as non generic alternative