init(from:named:)
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) async throwsParameters
- data:
The Data object containing the in-memory contents of the file to load.
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 automatically determines the file type using the first few bytes of the Data object.
For more information on loading entities, see Loading entities from a file.
See init(named:in:) for an example of optimally loading content.