onUnmount method

  1. @override
void onUnmount()
override

Called when the owning node leaves a live scene graph.

Implementation

@override
void onUnmount() {
  // Guard on attachment, not mount state: Component.unmount clears the
  // mounted flag before invoking onUnmount, and the owning node's render
  // scene is still reachable during teardown (mirrors MeshComponent).
  if (isAttached) {
    node.internalRenderScene?.removeDirectionalLight(this);
  }
}