<!--
{
  "availability" : [
    "iOS: 13.0.0 - 27.3.0",
    "iPadOS: 13.0.0 - 27.3.0",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 - 27.3.0",
    "tvOS: 26.0.0 - 27.3.0",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/EnvironmentResource/load(named:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation19EnvironmentResourceC4load5named2inACSS_So8NSBundleCSgtKFZ"
  },
  "title" : "load(named:in:)"
}
-->

# load(named:in:)

Synchronously loads an environment resource from a bundle.

```
@MainActor @preconcurrency static func load(named name: String, in bundle: Bundle? = nil) throws -> EnvironmentResource
```

## Parameters

`name`

The image name without the file extension.

`bundle`

The bundle to search for the resource. Use `nil` to indicate the app’s bundle.

## Return Value

The environment resource that loads from the specified bundle.

## Discussion

Loading an [`EnvironmentResource`](/documentation/RealityKit/EnvironmentResource) 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.

If your image file is at the path `Foo.skybox/Bar.exr` in your Xcode project,
use `Bar` for the name parameter.

To add an environment resource to your Xcode project, see [`EnvironmentResource`](/documentation/RealityKit/EnvironmentResource).

> Important: This function blocks the calling thread while RealityKit loads the requested resource.

---

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)