init(from:named:contentType:)
Creates an entity by asynchronously loading it from the in-memory contents of a file stored in a Data object.
Declaration
@MainActor @preconcurrency convenience init(from data: Data, named name: String? = nil, contentType: UTType) async throwsParameters
- data:
The Data object containing the in-memory contents of the file to load.
- contentType:
The content type of the file to load. This can be any of the aforementioned file types, expressed as a UTType.
Return Value
The root entity of the loaded file.
Discussion
RealityKit supports loading entities from USD (.usd, .usda, .usdc, .usdz) and Reality (.reality) files. This method attempts to load the data based on the content type specified instead of automatically determining it.
For more information on loading entities, see Loading entities from a file.
See init(named:in:) for an example of optimally loading content.