---
title: "replace(with:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/textureresource/replace(with:)"
---

# replace(with:)

Replaces a texture resource with a low-level texture.

## Declaration

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

## Parameters

- `texture`: The texture data that defines the resource.

## Discussion

Discussion warning: It’s more efficient to use replace(using:) to update a 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.

## See Also

### Modifying the texture

- [replace(withDrawables:)](realitykit/textureresource/replace(withdrawables:).md)
- [replace(withImage:options:)](realitykit/textureresource/replace(withimage:options:).md)
- [replace(using:options:)](realitykit/textureresource/replace(using:options:).md)
