# OnDisable()

> Called when the graph is unloaded, or goes out of scope in the editor.

## Definition

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

```csharp
public virtual void OnDisable()
```

### Remarks

Unity calls this method when the graph is disabled, or is destroyed. Override this method to release resources, clear temporary data, or perform any required cleanup. This method complements [Graph.OnEnable](/engine/6000.6/script-reference/unity/graphtoolkit/editor/graph/onenable.md) and is useful for maintaining consistency across editor sessions.
