---
title: "replaceIndices(using:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/lowlevelmesh/replaceindices(using:)"
---

# replaceIndices(using:)

Retrieves a Metal index buffer that you can use to replace the indices of this low-level mesh.

## Declaration

```swift
@MainActor func replaceIndices(using commandBuffer: any MTLCommandBuffer) -> any MTLBuffer
```

## Parameters

- `commandBuffer`: The doc://com.apple.documentation/documentation/Metal/MTLCommandBuffer you intend to use for reading. RealityKit waits for the command buffer to complete before discarding the buffer.

## Discussion

Discussion The buffer’s contents are in an uninitialized state.

## See Also

### Accessing mesh data on the GPU with Metal

- [read(bufferIndex:using:)](realitykit/lowlevelmesh/read(bufferindex:using:).md)
- [readIndices(using:)](realitykit/lowlevelmesh/readindices(using:).md)
- [replace(bufferIndex:using:)](realitykit/lowlevelmesh/replace(bufferindex:using:).md)
