<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/LowLevelTexture/replace(deviceResource:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation15LowLevelTextureC7replace14deviceResource5usingyAA0cd6DeviceH0C_So16MTLCommandBuffer_pSgtF"
  },
  "title" : "replace(deviceResource:using:)"
}
-->

# replace(deviceResource:using:)

Replaces this object’s underlying texture with an existing [`LowLevelDeviceResource`](/documentation/RealityKit/LowLevelDeviceResource) created and managed by the application.

```
@MainActor func replace(deviceResource: LowLevelDeviceResource, using commandBuffer: (any MTLCommandBuffer)? = nil)
```

## Parameters

`deviceResource`

The underlying texture this object should refer to.

`commandBuffer`

The <doc://com.apple.documentation/documentation/Metal/MTLCommandBuffer>
you intend to use for texture modifications.
RealityKit waits for the command buffer to complete before utilizing the texture for rendering.

## Discussion

While it’s valid to replace a LowLevelTexture with an externally-managed texture having different dimensions,
the LowLevelTexture will remember its initial size and calling replace(using:) to obtain a new MTLTexture will respect the initial size.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)