---
title: "setObjectSamplerStates(_:range:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/setobjectsamplerstates(_:range:)"
---

# setObjectSamplerStates(_:range:)

Assigns multiple sampler states to a range of entries in the object shader argument table.

## Declaration

```swift
func setObjectSamplerStates(_ samplers: [(any MTLSamplerState)?], range: Range<Int>)
```

## Parameters

- `samplers`: An array of doc://com.apple.metal/documentation/Metal/MTLSamplerState instances the command assigns to entries in the object shader argument table for sampler states.
- `range`: A span of integers that represent the entries in the object shader argument table for sampler states. Each entry stores a record of the corresponding element in samplers.

## Discussion

Discussion By default, the sampler state at each index is nil. note: The Objective-C version of this method is setObjectSamplerStates:withRange:.

## See Also

### Assigning sampler states for object shaders

- [setObjectSamplerState(_:index:)](metal/mtlrendercommandencoder/setobjectsamplerstate(_:index:).md)
- [setObjectSamplerState(_:lodMinClamp:lodMaxClamp:index:)](metal/mtlrendercommandencoder/setobjectsamplerstate(_:lodminclamp:lodmaxclamp:index:).md)
- [setObjectSamplerStates(_:lodMinClamps:lodMaxClamps:range:)](metal/mtlrendercommandencoder/setobjectsamplerstates(_:lodminclamps:lodmaxclamps:range:).md)
