Skip to content

EntityPrefab.AddComponent(Action) Method

Definition

Namespace: Brine2D.ECS

Adds a component with a configuration action. The action is called after the component is added to configure its properties.

public Brine2D.ECS.EntityPrefab AddComponent<T>(System.Action<T>? configure=null)
    where T : Brine2D.ECS.Component, new();

Type parameters

T

Parameters

configure System.Action<T>

Returns

EntityPrefab

Example

prefab.AddComponent<TransformComponent>(t => t.Position = new Vector2(100, 200));