Stored Entities

Manage entities stored as assets on disk.

Overview

If you bundle 3D assets with your app, or download them from the network into local file storage, you need a way to load them at runtime. RealityKit provides a collection of methods that you use to load USD and Reality files into Entity instances.

Topics

Essentials

Loading Entities from a File

Retrieve an entity from storage on disk using a synchronous or an asynchronous load operation.

class LoadRequest

A resource loader that acts as a publisher.

Loading an Entity Hierarchy

static func load(named: String, in: Bundle?) -> Entity

Blocks your app while loading an entity from a file in a bundle.

static func load(contentsOf: URL, withName: String?) -> Entity

Blocks your app while loading an entity from a file URL.

static func loadAsync(named: String, in: Bundle?) -> LoadRequest<Entity>

Loads an entity from a file in a bundle asynchronously.

Loading an Anchor Entity

static func loadAnchor(named: String, in: Bundle?) -> AnchorEntity

Blocks your app while loading an anchor entity from a file in a bundle.

static func loadAnchor(contentsOf: URL, withName: String?) -> AnchorEntity

Blocks your app while loading an anchor entity from a file URL.

static func loadAnchorAsync(named: String, in: Bundle?) -> LoadRequest<AnchorEntity>

Loads an anchor entity from a file in a bundle asynchronously.

Loading a Flattened Model Entity

static func loadModel(named: String, in: Bundle?) -> ModelEntity

Blocks your app while loading a model entity from a file in a bundle.

static func loadModel(contentsOf: URL, withName: String?) -> ModelEntity

Blocks your app while loading a model entity from a file URL.

static func loadModelAsync(named: String, in: Bundle?) -> LoadRequest<ModelEntity>

Loads a model entity from a file in a bundle asynchronously.

Loading a Flattened Body-Tracked Entity

static func loadBodyTracked(named: String, in: Bundle?) -> BodyTrackedEntity

Blocks your app while loading a body-tracked entity from a file in a bundle.

static func loadBodyTracked(contentsOf: URL, withName: String?) -> BodyTrackedEntity

Blocks your app while loading a body-tracked entity from a file URL.

static func loadBodyTrackedAsync(named: String, in: Bundle?) -> LoadRequest<BodyTrackedEntity>

Loads a body-tracked entity from a file in a bundle asynchronously.