# OnWillBeDestroyed()

> Called when an Overlay is about to be destroyed.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Overlays](/engine/6000.6/script-reference/unityeditor/overlays.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public virtual void OnWillBeDestroyed()
```

### Remarks

Usually this corresponds to the [EditorWindow](/engine/6000.6/script-reference/unityeditor/editorwindow.md) in which this [Overlay](/engine/6000.6/script-reference/unityeditor/overlays/overlay.md) resides closing.
