---
title: "setObjectTexture(_:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/setobjecttexture(_:index:)"
---

# setObjectTexture(_:index:)

Assigns a texture to an entry in the object shader argument table.

## Declaration

```swift
func setObjectTexture(_ texture: (any MTLTexture)?, index: Int)
```

## Parameters

- `texture`: An doc://com.apple.metal/documentation/Metal/MTLTexture instance the command assigns to an entry in the object shader argument table for textures.
- `index`: An integer that represents the entry in the object shader argument table for textures that stores a record of texture.

## Discussion

Discussion By default, the texture at each index is nil.

## See Also

### Assigning textures for object shaders

- [setObjectTextures(_:range:)](metal/mtlrendercommandencoder/setobjecttextures(_:range:).md)
