loadAsync(named:in:)
Asynchronously loads an environment resource from a bundle.
Declaration
@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
nilto indicate the app’s bundle.
Return Value
The environment resource that loads from the specified bundle.
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.