Skip to content

Behavior.OnComponentRemoved(Component) Method

Definition

Namespace: Brine2D.ECS

Called when a component is removed from the same entity as this behavior. Fires before the component's Entity reference is cleared, so the component is still accessible via Brine2D.ECS.Entity.GetComponent<> during this callback.

C#
protected internal virtual void OnComponentRemoved(Brine2D.ECS.Component component);

Parameters

component Component

The component that was removed.

Example

C#
protected internal override void OnComponentRemoved(Component component)
{
    if (component is WeaponComponent)
        _currentWeapon = null;
}

Remarks

Use this to react to dynamic component changes — for example, releasing a cached weapon reference or disabling dependent logic when a required component is removed. Entity is guaranteed to be non-null inside this callback.