# UnsafeReinterpret<U>()

> Reinterpret the slice as having a different data type (type punning), but does not check if the reinterpret is valid.

## Definition

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

## UnsafeReinterpret\<T>()

```csharp
public BufferSlice<U> UnsafeReinterpret<U>() where U : struct
```

### Returns

| Type                                                                                          | Description                                                       |
| --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| [BufferSlice\<T>](/engine/6000.3/script-reference/unityengine/lighttransport/bufferslice1.md) | An alias of the same slice, but reinterpreted as the target type. |

### Remarks

Performs unchecked reinterpretation of the buffer slice to view the same memory as a different type. This method skips all validation and should only be used when you are certain the reinterpretation is valid.

**Use Cases:**

* Performance-critical code where validation overhead is unacceptable.
* Advanced scenarios where you need to bypass safety checks.
* Custom type layouts that don't follow standard alignment rules.

**Warning:** This method can lead to undefined behavior, memory corruption, or crashes if used incorrectly. Prefer BufferSlice\<T>.SafeReinterpret unless you have specific performance requirements.

Additional Resources: BufferSlice\<T>.SafeReinterpret for validated reinterpretation.

### Examples

```csharp
// Performance-critical reinterpretation
var floatSlice = new BufferSlice<float>(buffer, 0);

// Unsafe reinterpret for maximum performance
// WARNING: No validation - ensure this is safe!
var byteSlice = floatSlice.UnsafeReinterpret<byte>();

// Use with caution - misaligned access could crash
var intSlice = floatSlice.UnsafeReinterpret<int>(); // OK: same size
var doubleSlice = floatSlice.UnsafeReinterpret<double>(); // DANGEROUS: different size
```
