<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/TextureResource/Contents/Slice",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation15TextureResourceC8ContentsV5SliceV"
  },
  "title" : "TextureResource.Contents.Slice"
}
-->

# TextureResource.Contents.Slice

An object that references the pixel data for a single slice of a mipmap.

```
struct Slice
```

## Overview

2D array textures have `arrayLength` slices per mipmap, and cube textures have six slices
per mipmap. 2D and 3D textures have a single slice per mipmap.

## Topics

### Creating a texture slice

[`static func slice(data: Data, bytesPerRow: Int) -> TextureResource.Contents.Slice`](/documentation/RealityKit/TextureResource/Contents/Slice/slice(data:bytesPerRow:))

Specifies a single mipmap level slice of a texture resource with pixel data that RealityKit copies from a byte buffer.

[`static func slice(unsafeBuffer: any MTLBuffer, offset: Int, size: Int, bytesPerRow: Int) -> TextureResource.Contents.Slice`](/documentation/RealityKit/TextureResource/Contents/Slice/slice(unsafeBuffer:offset:size:bytesPerRow:))

Specifies a single mipmap level slice of a texture resource with pixel data that RealityKit copies from a Metal buffer.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)