---
title: "load(named:in:)"
framework: realitykit
role: symbol
role_heading: Type Method
path: "realitykit/environmentresource/load(named:in:)"
---

# load(named:in:)

Synchronously loads an environment resource from a bundle.

## Declaration

```swift
@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

Return Value The environment resource that loads from the specified bundle.

## Discussion

Discussion Loading an 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. important: This function blocks the calling thread while RealityKit loads the requested resource.

## See Also

### Loading the resource

- [init(named:in:)](realitykit/environmentresource/init(named:in:).md)
- [init(equirectangular:withName:)](realitykit/environmentresource/init(equirectangular:withname:)-8o2v7.md)
- [init(equirectangular:withName:)](realitykit/environmentresource/init(equirectangular:withname:)-8o2v7.md)
- [init(cube:options:)](realitykit/environmentresource/init(cube:options:)-9j9rn.md)
- [init(cube:options:)](realitykit/environmentresource/init(cube:options:)-9j9rn.md)
