# Cancel()

> Cancel the asynchronous operation.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.LightTransport](/engine/6000.0/script-reference/unityengine/lighttransport.md)
* **Assembly:** UnityEditor

```csharp
public void Cancel()
```

### Remarks

Requests cancellation of any ongoing operations that use this progress state. This method returns immediately and the operation is cancelled once the implementation has a chance to react to the request and terminate the operation.

**Cancellation Behavior:**

* The cancellation request is cooperative - operations must check for cancellation.
* Not all operations support cancellation.
* Cancellation may take time to take effect.
* Use [BakeProgressState.WasCancelled](/engine/6000.0/script-reference/unityengine/lighttransport/bakeprogressstate/wascancelled.md) to check if cancellation was requested.

**Note:** This method only requests cancellation; it does not force immediate termination.

### Examples

```csharp
// Set up cancellable baking operation
using var progress = new BakeProgressState();
var integrator = new RadeonRaysProbeIntegrator();
integrator.SetProgressReporter(progress);

// Start long-running operation
var bakeTask = Task.Run(() =>
{
    return integrator.IntegrateIndirectRadiance(
        context, 0, 10000, 4096, false, outputBuffer);
});

// Allow user to cancel with UI button
cancelButton.onClick.AddListener(() =>
{
    progress.Cancel();
    statusText.text = "Cancelling...";
});

// Wait for completion or cancellation
var result = await bakeTask;
if (progress.WasCancelled())
{
    statusText.text = "Bake was cancelled";
}
```
