---
title: "setObjectSamplerStates:withRange:"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/setobjectsamplerstates:withrange:"
---

# setObjectSamplerStates:withRange:

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

## Declaration

```occ
- (void) setObjectSamplerStates:(id<MTLSamplerState> const[]) samplers withRange:(NSRange) range;
```

## Parameters

- `samplers`: A pointer to a C 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 Swift version of this method is setObjectSamplerStates(_:range:).

## 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:withRange:](metal/mtlrendercommandencoder/setobjectsamplerstates:lodminclamps:lodmaxclamps:withrange:.md)
