# Dispose(ControlContext, ref TRealtime)

> Called when the generator is destroyed, after having left the processing thread.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Audio](/engine/6000.5/script-reference/unityengine/audio.md)
* **Assembly:** UnityEngine.AudioModule

## Dispose(ControlContext, T)

```csharp
void Dispose(ControlContext context, ref TRealtime realtime)
```

### Parameters

**** (\[ControlContext]\(/engine/6000.5/script-reference/unityengine/audio/controlcontext)): **** (T):&#x20;

### Remarks

Here you can clean up any resources that were allocated for the control or realtime thread. It may take an indeterminate amount of time between [ControlContext.Destroy](/engine/6000.5/script-reference/unityengine/audio/controlcontext/destroy.md) is called and this will be called, and there may be any number of [ProcessorInstance.IControl\<TRealtime>.Update](/engine/6000.5/script-reference/unityengine/audio/processorinstance/icontrol1/update.md) calls inbetween. This is because destroying realtimes is an asynchronous process.

Additional Resources: [RootOutputInstance.IRealtime.RemovedFromProcessing](/engine/6000.5/script-reference/unityengine/audio/rootoutputinstance/irealtime/removedfromprocessing.md), [ControlContext.Destroy](/engine/6000.5/script-reference/unityengine/audio/controlcontext/destroy.md)
