RealityKit Asset Loading
This package includes classes and examples that enable easy, convenient asynchronous asset loading in RealityKit for all of these kinds of assets:
- USDZ animations
- Scenes from .reality files
- Scenes from .rcproject files
It also includes some convenience methods for generating simple shapes (box, sphere and plane) with simple materials.
There are different options provided: some for loading one file at a time, and others for loading many all together at once. You oftentimes have the option of either providing a URL specifying the location of the file on disk to load, or providing a file name and a bundle (bundle is optional – it defaults to the main bundle).
This package only includes asynchronous loading methods.
Synchronous load operations block the thread on which you call them which can lead to the user interface stalling and the app becoming unresponsive, especially when loading complex scenes like is often done for AR experiences.
To maintain a smooth user interface, it’s typically best to use an asynchronous load instead. All synchronous load operations have an asynchronous counterpart.
See these documentation articles for more information:
- Loading Reality Composer Files Manually Without Generated Code
- Loading Reality Composer Files Using Generated Code
- Loading Entities From a File
- iOS 13 or macOS 10.15
- Swift 5.2
- Xcode 11
Swift Package Manager
Add the URL of this repository to your Xcode 11+ Project under:
File > swift packages > add package dependency
import RKAssetLoading to the top of your swift file to start.