Skip to content

Entity.OnDestroy() Method

Definition

Namespace: Brine2D.ECS

Called once when the entity is destroyed and removed from the world. Override to implement custom cleanup logic.

public virtual void OnDestroy();

Remarks

Components receive OnRemoved() automatically during destruction. Children are destroyed synchronously so their OnDestroy can safely access parent state (components, behaviors, etc.). Each child is then queued for deferred removal from the world so that the entity lookup and tag index are properly cleaned up.