# IsDestroying()

> Checks if the GameObject and its descendants are currently in the process of being destroyed.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public bool IsDestroying()
```

### Returns

| Type                                                          | Description                         |
| ------------------------------------------------------------- | ----------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | Is this GameObject being destroyed. |

### Remarks

This function is only needed in the OnDestroy() lifetime callbacks for MonoBehaviours. For example if you need to instantiate a GameObject in an OnDestroy() callback under a specific parent GameObject, you will need to check if that parent GameObject is also in process of being destroyed before using it as a parent. Additional Resources: [MonoBehaviour.OnDestroy()](/engine/6000.7/script-reference/unityengine/monobehaviour/ondestroy.md).
