<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/Entity/init(from:named:contentType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation6EntityC4from5named11contentTypeAC0B04DataV_SSSg07UniformG11Identifiers6UTTypeVtYaKcfc"
  },
  "title" : "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.

```
@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 format of `data`, expressed as a `UTType`. RealityKit
uses this value to select a parser instead of guessing the file type from the data.

## Return Value

The root entity of the loaded file.

## Discussion

RealityKit supports loading entities from USD (`.usd`, `.usda`, `.usdc`,
`.usdz`) and Reality (`.reality`) files. Pass the data’s format as the
`contentType` so RealityKit selects a parser directly instead of guessing
the file type from the data. Prefer this initializer over
[`init(from:named:)`](/documentation/RealityKit/Entity/init(from:named:)) when the format is already known — for example from a
server’s `Content-Type` or a MIME type.

The supported content types are:

- `UTType.usd` for USD content (`.usd`, `.usda`, `.usdc`).
- `UTType.usdz` for USD package files (`.usdz`).
- `UTType.realityFile` for Reality files (`.reality`).

When you only have a file name or extension, look up the `UTType` using `UTType()`, e.g.:

```swift
let contentType = UTType(filenameExtension: url.pathExtension) ?? .usd
let entity = try await Entity(from: data, contentType: contentType)
```

For more information on loading entities, see
[Loading entities from a file](/documentation/RealityKit/loading-entities-from-a-file).

See [`init(named:in:)`](/documentation/RealityKit/Entity/init(named:in:)) for an example of optimally loading content.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)