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

# replace(with:)

Replaces a texture resource with a low-level texture.

```
@MainActor @preconcurrency func replace(with texture: LowLevelTexture)
```

## Parameters

`texture`

The texture data that defines the resource.

## Discussion> Warning: It’s more efficient to use ``doc://com.apple.RealityKit/documentation/RealityKit/LowLevelTexture/replace(using:)``
> to update a ``doc://com.apple.RealityKit/documentation/RealityKit/LowLevelTexture`` on the GPU than it is to update the `TextureResource`.
> Prefer to update the `LowLevelTexture` directly instead.

> Note: This method marks the asset as mutated, preventing newly loaded entities from sharing
> the texture.

---

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)