# EventID

> Unique identifier for tracking asynchronous operations executing on a device context.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEngine.LightTransport](/engine/6000.5/script-reference/unityengine/lighttransport.md)
* **Assembly:** UnityEngine.CoreModule
* **Implements:** [IEquatable\<EventID>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public struct EventID : IEquatable<EventID>
```

## Remarks

The EventID is used to track the completion status of asynchronous operations such as buffer reads and writes. Each EventID represents a unique operation and provides a mechanism to query completion status or wait for operation completion.

Key characteristics of EventID:

* Single-use: Each EventID can only be used for one operation.
* Non-reusable: After being passed to an operation, it cannot be reused.
* Must be destroyed: Use [IDeviceContext.DestroyEvent](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/destroyevent.md) to prevent resource leaks.
* Thread-safe: Can be queried from different threads.

EventIDs are commonly used with:

* [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) operations.
* [IDeviceContext.Wait](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/wait.md) for blocking until completion.
* [IDeviceContext.IsCompleted](/engine/6000.5/script-reference/unityengine/lighttransport/idevicecontext/iscompleted.md) for non-blocking status checks.

## Examples

```csharp
// Create events to track multiple async operations
var writeEvent = context.CreateEvent();
var readEvent = context.CreateEvent();

// Start async write operation
context.WriteBuffer(bufferSlice, inputData, writeEvent);

// Start async read operation (depends on write completing)
context.ReadBuffer(bufferSlice, outputData, readEvent);

// Submit all operations for execution
context.Flush();

// Wait for write to complete before proceeding
bool writeSuccess = context.Wait(writeEvent);
Assert.IsTrue(writeSuccess);

// Check if read completed without blocking
if (context.IsCompleted(readEvent))
{
    Debug.Log("Read operation completed");
}
else
{
    // Wait for read to complete
    bool readSuccess = context.Wait(readEvent);
    Assert.IsTrue(readSuccess);
}

// Clean up events.
context.DestroyEvent(writeEvent);
context.DestroyEvent(readEvent);
```

## Fields

| Value                                                                                | Description                            |
| ------------------------------------------------------------------------------------ | -------------------------------------- |
| [Value](/engine/6000.5/script-reference/unityengine/lighttransport/eventid/value.md) | The underlying event identifier value. |

## Constructors

| Constructor                                                                                          | Description                                                                                              |
| ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| [EventID(System.UInt64)](/engine/6000.5/script-reference/unityengine/lighttransport/eventid/ctor.md) | Construct a new [EventID](/engine/6000.5/script-reference/unityengine/lighttransport/eventid.md) object. |
