@MainActor @preconcurrency static func load(named name: String, from scene: String, in bundle: Bundle? = nil) throws -> AudioFileGroupResource
Loads an audio resource from a Reality Composer Pro project.
This method loads a preconfigured ``RealityKit/AudioFileGroupResource`` from a
scene in a Reality Composer Pro project.
- Important: The name provided **must** be unique.
- Parameters:
- name: The USD Prim path to the resource in the Reality Composer Pro project to load.
- scene: The name of the Reality Composer Pro scene to load from.
- bundle: The bundle that contains the project. Leave `nil` to load from the app's bundle.
@MainActor @preconcurrency convenience init(named name: String, from scene: String, in bundle: Bundle) async throws
Initializes an audio resource from a Reality Composer Pro project.
This method initializes a preconfigured ``AudioFileGroupResource`` from a
scene in a Reality Composer Pro project.
- Important: The name provided **must** be unique.
- Parameters:
- name: The USD Prim path to the resource in the Reality Composer Pro project to initialize.
- scene: The name of the Reality Composer Pro scene to initialize from.
- bundle: The bundle that contains the project.
get · iOS 18.0+
resources
TypeScript
get resources(): Promise<Array<AudioFileResource>>
Swift declaration
@MainActor @preconcurrency final let resources: [AudioFileResource]
The `AudioFileResource` objects which comprise this `AudioFileGroupResource`.
Creates a group resource from an array of audio file resources (backward compatibility).
This initializer maintains backward compatibility with existing code that doesn't specify configuration.
- Parameter resources: The audio file resources for the group
- Throws: An error if the provided array is empty or if the underlying audio assets do not have matching channel layouts.