<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/TextureResource/replace(using:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation15TextureResourceC7replace5using7optionsySo10CGImageRefa_AC13CreateOptionsVtYaKF"
  },
  "title" : "replace(using:options:)"
}
-->

# replace(using:options:)

Asynchronously replaces the texture with a Core Graphics image.

```
@MainActor @preconcurrency func replace(using cgImage: CGImage, options: TextureResource.CreateOptions) async throws
```

## Parameters

`cgImage`

The source image.

`options`

Options that specify the type of texture to create. To preserve `TextureResource` usage, specify the same semantic.

## Discussion

Don’t use this method for updates at frame-rate frequency.
For frequent texture changes, see [`replace(withDrawables:)`](/documentation/RealityKit/TextureResource/replace(withDrawables:)).
To ensure consistent usage of this texture resource, pass the same semantic
in `options` that you use to create the resource.

> Note: The contents of a modified texture resource don’t sync between network clients.

---

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)