<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/TextureResource/load(contentsOf:withName:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation15TextureResourceC4load10contentsOf8withName7optionsAC0B03URLV_SSSgAC13CreateOptionsVtKFZ"
  },
  "title" : "load(contentsOf:withName:options:)"
}
-->

# load(contentsOf:withName:options:)

Synchronously loads a texture resource from a URL with options.

```
@MainActor @preconcurrency static func load(contentsOf url: URL, withName resourceName: String? = nil, options: TextureResource.CreateOptions) throws -> TextureResource
```

## Parameters

`url`

The URL of the resource.

`resourceName`

A unique name the method assigns to the resource it loads,
for use in network synchronization.

`options`

A configuration for generating the texture.

## Return Value

The loaded resource.

## Discussion

Loading a [`TextureResource`](/documentation/RealityKit/TextureResource) with this method blocks the main actor because it’s synchronous, so only call it from a command-line application.
The method can stall a regular app, which makes it visibly hitch, and the system terminates an app if its UI becomes unresponsive.
See [`init(named:in:)`](/documentation/RealityKit/TextureResource/init(named:in:)) for an example that demonstrates how to safely load content.

This method loads the image that the `URL` specifies, and creates a texture
resource from it.
The method blocks until it finishes loading the image and creating
the texture resource.

RealityKit uses the resource name to identify resources, and to match
texture resources between networked peers. Specify a unique name for
each texture resource you load or generate.

---

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)