Hi
Hopefully someone can share some ideas on how to accomplish this.
I know we can load models from realityKitContentBundle like
let model = try? await Entity(named: “testModel”, in: realityKitContentBundle)
But this is in the root of RealityKitContent.rkassets , if I have the models in some subfolder then I have to add the complete path like
let model = try? await Entity(named: “/superModels/testModel”, in: realityKitContentBundle)
What I want is to be able to search recursively in all folders for that file as I have several subfolders with different models.
Any suggestion ?
Thanks in advance.
Guillermo
Good news. You don’t need to combine all your USDA files into one.
The recommended approach is adding a Reality Composer Pro project, containing your USDA files, to your Xcode project.
This creates a Swift package (.reality file) from which you can find and create Entities (possibly described by multiple USDA files). In other words, take advantage of Reality Composer Pro to package your USDA assets so they can be used in your Xcode project as Entities.
For more details check out Meet Reality Composer Pro.
If you prefer to instantiate Entities directly from USDA both init and load functions can handle a USDA file composed of other USDA files by reference. Note: an asset reference must exist within the app's sandbox.
For more information about USD composition and references watch this section of Understand USD fundamentals.