Abstract:
I’m engaged on a VisionOS venture the place I have to dynamically load a .bundle file containing RealityKit content material from the app’s Utility Assist listing. The .bundle is saved to disk after being downloaded or retrieved as an On-Demand Useful resource (ODR).
Pattern venture with the difficulty:
Github repo. Play the goal test-odr to make use of with the native bundle and have the crash.
General drawback:
-
Setup: Add a .bundle named RealityKitContent_RealityKitContent.bundle to the app’s assets. This bundle accommodates a Actuality file with two USDA,: “Immersive” and “Scene”.
-
Save to Disk: save the bundle to the Utility Assist listing, guaranteeing that the file is accurately copied and saved.
-
Load the Bundle: load the bundle from the saved URL utilizing
Bundle(url: bundleURL)
to initialize the Bundle object. -
Load Entity from Bundle: load a particular entity (“Scene”) from the bundle. When making an attempt to load the entity utilizing
let storedEntity = attempt await Entity(named: "Scene", in: bundle),
the app crashes with an EXC_BREAKPOINT error. -
ContentsOf Methodology Situation: If I exploit the
Entity.load(contentsOf:realityFileURL, withName: entityName)
methodology, it all the time masses the primary root entity discovered (on this case, “Immersive”) fairly than “Scene”, even when specifying the entity title. For this reason I need to use the Bundle to load entities by title extra exactly.
Situation:
The crash persistently happens on the Entity(named: "Scene", in: bundle) line.
I’ve verified that the bundle exists and is accessible on the specified path and that it accommodates the anticipated .actuality file with a number of entities (“Immersive” and “Scene”). The error code I get is EXC_BREAKPOINT (code=1, subcode=0x1d135d4d0).
What I’ve Tried:
• Ensured the bundle is correctly saved and accessible.
• Checked that the bundle is initialized accurately from the URL.
• Examined loading the entity utilizing the contentsOf methodology, which works advantageous however all the time masses the “Immersive” entity, ignoring the desired title. Therefore, I need to use the Bundle-based strategy to load a number of USDA entities selectively.
Query:
Has anybody confronted the same problem or is aware of why loading entities utilizing Entity(named:in:) from a disk-based bundle causes this crash? Any recommendation on learn how to debug or resolve this, particularly for managing a number of root entities in a .actuality file, can be tremendously appreciated.