---
title: Slice<T>(ulong)
product: Unity Editor
version: '6000.3'
latest_version: '7000.0'
status: This page documents version 6000.3. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/6000.3/script-reference/unityengine/lighttransport/bufferid/slice
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unityengine/lighttransport/bufferid/slice.md
last_updated: 2026-09-14
generated_at: 2026-11-16T07:58:44.166Z
locale: en-us
---

# Slice<T>(ulong)

> Constructs a typed slice from the BufferID.

## Definition

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

```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.3/script-reference/unityengine/lighttransport/bufferslice1.md) | A typed slice aliasing the BufferID. |

### Remarks

Creates a [BufferSlice](/engine/6000.3/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 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.3/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);
```
