Skip to content

Behavior.OnAttached() Method

Definition

Namespace: Brine2D.ECS

Called once when the behavior is attached to an entity. Use this to validate required components and cache references.

protected internal virtual void OnAttached();

Example

protected override void OnAttached()
{
    _transform = Entity.GetRequiredComponent<TransformComponent>();
    _velocity  = Entity.GetComponent<VelocityComponent>();
}