---
title: "setTexture(_:at:)"
framework: realitykit
role: symbol
role_heading: Instance Method
platforms: [iOS 27.0+, iPadOS 27.0+, macOS 27.0+, tvOS 27.0+, visionOS 27.0+]
path: "realitykit/computegraphcomponent/settexture(_:at:)"
---

# setTexture(_:at:)

Binds a Metal texture to a parameter at the given index.

## Declaration

```swift
mutating func setTexture(_ texture: (any MTLTexture)?, at index: Int)
```

## Parameters

- `texture`: The MTLTexture to bind, or nil to unbind the current texture.
- `index`: The index of the texture parameter in the texture table.
