# Slice<T>(ulong)

> Constructs a typed slice from the BufferID.

## Definition

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

```csharp
public BufferSlice<T> Slice<T>(ulong offset = 0) where T : struct
```

### Parameters

**** (\[ulong]\(https\://learn.microsoft.com/dotnet/api/system.uint64)): The offset to use for the slice, measured in elements of the specified type.

### Returns

| Type                                                                                          | Description                          |
| --------------------------------------------------------------------------------------------- | ------------------------------------ |
| [BufferSlice\<T>](/engine/6000.6/script-reference/unityengine/lighttransport/bufferslice1.md) | A typed slice aliasing the BufferID. |

### Remarks

Creates a [BufferSlice](/engine/6000.6/script-reference/unityengine/lighttransport/bufferslice1.md) that provides a typed view into the buffer starting at the specified offset. This is a convenience method equivalent to constructing a [BufferSlice](/engine/6000.6/script-reference/unityengine/lighttransport/bufferslice1.md) manually.

The offset is measured in elements of type T, not in bytes. This method provides type safety and helps prevent common offset calculation errors.

Additional Resources: [BufferSlice](/engine/6000.6/script-reference/unityengine/lighttransport/bufferslice1.md) for detailed slice operations and examples.

### Examples

```csharp
// Create a large buffer for mixed data
BufferID sharedBuffer = context.CreateBuffer(1000, sizeof(float));

// Create slices using the convenience method
var firstSection = sharedBuffer.Slice<float>(0);     // Elements 0-299
var secondSection = sharedBuffer.Slice<Vector3>(300); // Elements 300-399 as Vector3s

// Equivalent to manual BufferSlice construction
var manualSlice = new BufferSlice<float>(sharedBuffer, 0);
Debug.Assert(firstSection.Id.Value == manualSlice.Id.Value);
Debug.Assert(firstSection.Offset == manualSlice.Offset);
```
