# OnViewDetached()

> Called when the node's INodeView.Root is detached from its UI panel.

## Definition

* **Type:** Method
* **Namespace:** [Unity.GraphToolkit.Editor](/engine/6000.7/script-reference/unity/graphtoolkit/editor.md)
* **Assembly:** UnityEditor

```csharp
public virtual void OnViewDetached()
```

### Remarks

Fires whenever the visual element receives a [DetachFromPanelEvent](/engine/6000.7/script-reference/unityengine/uielements/detachfrompanelevent.md). Like [NodeView\<T>.OnViewAttached](/engine/6000.7/script-reference/unity/graphtoolkit/editor/nodeview1/onviewattached.md), this can fire multiple times in a node's lifetime (tab switches, block-node drags, and so on), and a matching [NodeView\<T>.OnViewAttached](/engine/6000.7/script-reference/unity/graphtoolkit/editor/nodeview1/onviewattached.md) may follow. Use this callback to release resources tied to panel presence, such as event subscriptions or scheduled tasks.
