# WasCancelled()

> Checks whether the work represented by this progress state was cancelled.

## Definition

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

```csharp
public bool WasCancelled()
```

### Returns

| Type                                                          | Description                     |
| ------------------------------------------------------------- | ------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the work was cancelled. |

### Remarks

Returns true if [BakeProgressState.Cancel](/engine/6000.5/script-reference/unityengine/lighttransport/bakeprogressstate/cancel.md) was called on this progress state. This method can be used by both the implementation and user code to check if cancellation was requested.

**Usage Patterns:**

* Check cancellation status after operations complete.
* Poll during long-running custom operations.
* Determine final operation result (success vs cancelled).

**Note:** A cancelled operation may still produce partial results depending on when cancellation occurred.

### Examples

```csharp
// Handle cancellation in batch processing
using var progress = new BakeProgressState();
progress.SetTotalWorkSteps((ulong)scenes.Length);

var results = new List<BakeResult>();
for (int i = 0; i < scenes.Length; i++)
{
    // Check for cancellation before each scene
    if (progress.WasCancelled())
    {
        Debug.Log($"Batch cancelled after {i} scenes");
        break;
    }

    var sceneResult = BakeScene(scenes[i], progress);
    results.Add(sceneResult);

    progress.IncrementCompletedWorkSteps(1);
}

// Determine final status
if (progress.WasCancelled())
{
    Debug.Log($"Batch processing cancelled. Completed {results.Count}/{scenes.Length} scenes.");
}
else
{
    Debug.Log($"Batch processing completed successfully. Processed {results.Count} scenes.");
}
```
