# OnStopRunning()

> Called when this system stops running because no entities match the system's EntityQuery objects or because you change the system ComponentSystemBase.Enabled property to false.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

```csharp
protected virtual void OnStopRunning()
```

### Remarks

If the [EntityQuery](/engine/7000.0/script-reference/unity/entities/entityquery.md) objects defined for a system do not match any existing entities then the system skips updating until a successful match is found. Likewise, if you set [ComponentSystemBase.Enabled](/engine/7000.0/script-reference/unity/entities/componentsystembase/enabled.md) to false, then the system stops running. In both cases, OnStopRunning is called when a running system stops updating; [ComponentSystemBase.OnStartRunning()](/engine/7000.0/script-reference/unity/entities/componentsystembase/onstartrunning.md) is called when it starts updating again.
