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

# loadAsync(named:in:)

Asynchronously loads an environment resource from a bundle.

## Declaration

```swift
@MainActor @preconcurrency static func loadAsync(named name: String, in bundle: Bundle? = nil) -> LoadRequest<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 If your image file is at the path Foo.skybox/Bar.exr in your Xcode project, use Bar for the name parameter. You need to call this function with the async keyword from an asynchronous context, such as from within a Task closure. To add an environment resource to your Xcode project, see EnvironmentResource.

## See Also

### Deprecated

- [generate(fromEquirectangular:withName:)](realitykit/environmentresource/generate(fromequirectangular:withname:)-3wtpe.md)
- [generate(fromEquirectangular:withName:)](realitykit/environmentresource/generate(fromequirectangular:withname:)-6mxsi.md)
