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

# copyAsync(to:completionHandler:)

Asynchronously copies texture data to another texture.

```
@MainActor @preconcurrency func copyAsync(to texture: any MTLTexture, completionHandler: @escaping @MainActor ((any Error)?) -> Void)
```

## Parameters

`texture`

The target texture for copying the data.
It needs to have the same width and height as [`TextureResource`](/documentation/RealityKit/TextureResource), and
<doc://com.apple.documentation/documentation/Metal/MTLTextureUsage/shaderWrite> usage.

`completionHandler`

The system calls this closure after it finishes copying the data, with a `nil` error if it succeeds.

## Discussion

This function is asynchronous. It returns immediately and runs in the background, calling `completionHandler` when it finishes or errors.
This method copies all available mipmap sizes to `texture`.

It’s recommended that you provide a value for [`semantic`](/documentation/RealityKit/TextureResource/CreateOptions/semantic) when creating this resource. Specifying a
semantic enables RealityKit to select an appropriate pixel format for the target 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)