---
title: "init(from:named:contentType:)"
framework: realitykit
role: symbol
role_heading: Initializer
path: "realitykit/entity/init(from:named:contenttype:)"
---

# 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

```swift
@MainActor @preconcurrency convenience init(from data: Data, named name: String? = nil, contentType: UTType) async throws
```

## Parameters

- `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

Return Value The root entity of the loaded file.

## Discussion

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.
