# CreateEvent()

> Creates a synchronization event for tracking asynchronous operations.

## Definition

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

```csharp
EventID CreateEvent()
```

### Returns

| Type                                                                             | Description                                    |
| -------------------------------------------------------------------------------- | ---------------------------------------------- |
| [EventID](/engine/6000.5/script-reference/unityengine/lighttransport/eventid.md) | Unique identifier for the newly created event. |

### Remarks

Events provide a mechanism to track the completion status of asynchronous operations such as [IDeviceContext.ReadBuffer](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/readbuffer.md) and [IDeviceContext.WriteBuffer](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/writebuffer.md). Each event can be used only once. After being passed to a read or write operation, it cannot be reused.

Use [IDeviceContext.Wait](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/wait.md) to block until an event completes, or [IDeviceContext.IsCompleted](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/iscompleted.md) to check completion status without blocking.

**Important:** Events are single-use and must be destroyed with [IDeviceContext.DestroyEvent](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/destroyevent.md) after use to prevent resource leaks.

### Examples

```csharp
// Create an event to track a write operation
var writeEvent = context.CreateEvent();
context.WriteBuffer(bufferSlice, inputData, writeEvent);

// Check if the operation completed
if (context.IsCompleted(writeEvent))
{
    Console.WriteLine("Write operation completed");
    context.DestroyEvent(writeEvent);
}
```
