# Flush()

> Initiates execution of all enqueued operations on the device.

## Definition

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

```csharp
bool Flush()
```

### Returns

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

### Remarks

Forces the device to begin processing all previously enqueued operations such as buffer reads, writes, and compute operations. Some implementations may flush automatically, while others require explicit flushing.

This method returns immediately after submitting the operations to the device. Non-blocking operations that produce an event can be followed by a call to [IDeviceContext.Wait](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/wait.md), to perform a blocking wait while the event completes. Use [IDeviceContext.IsCompleted](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/iscompleted.md) to determine if an event produced by an asynchronous operation has completed.

**Performance Note:** Call [IDeviceContext.Flush()](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/flush.md) once after enqueuing multiple operations rather than after each individual operation for better performance.

### Examples

```csharp
// Enqueue multiple operations
context.WriteBuffer(slice1, data1, event1);
context.WriteBuffer(slice2, data2, event2);
context.ReadBuffer(slice3, data3, event3);

// Submit all operations for execution
bool flushSuccess = context.Flush();
Assert.IsTrue(flushSuccess);

// Wait for all operations to complete
context.Wait(event1);
context.Wait(event2);
context.Wait(event3);
```
