Contents

init(contentsOf:withName:)

Creates an entity by asynchronously loading it from a file URL.

Declaration

@MainActor @preconcurrency convenience init(contentsOf url: URL, withName resourceName: String? = nil) async throws

Parameters

  • url:

    A file URL representing the file to load.

  • resourceName:

    A unique name the method assigns to the resource it loads, for use in network synchronization.

Return Value

The root entity of the loaded file.

Discussion

RealityKit supports loading entities from USD (.usd, .usda, .usdc, .usdz) and Reality (.reality) files.

For more information on loading entities, see Loading entities from a file.

See init(named:in:) for an example of optimally loading content.

See Also

Loading an entity from a file