Peer failed to load asset path in multipeer realitykit

Hello,


I have a realitykit project and the scene has some resources which are from a usdz file. After syncing the resources which were part of the file are not received by the peer. It gives the following error string "[Assets] Failed to load asset path 'singlefilearchive:"


Any clues?

Replies

I am using copy bundle resources in build phases already

This is related to compiledmesh in the usdz file.


However, the entities are completely read from the file. I am not sure where the references are still in the file

Has this issue been resolved yet?


I'm wokring on a RealityKit Multipeer game and I have the exactly same issue when a clien tries to display a game board full of USDZ assets created by a host.


Could someone from Apple give us a hand here?


Thanks.

Hello! It seems to me that I have a similar problem.

I create an application with a multi-user session, peers download models from local directory on their device, and they can have a different set of models on devices, even if Model A is loaded locally on both peer A and peer B - peer A places it on scene, and peer B sees only "frame" of model A (AnchorEntity + ParentModel (this is a container for ModelEntity) + interaction manipulators), that is, ModelEntity itself (which is a descendant of ParentModel) does not appear. If I catch ARAnchor of Model A from node B in

session (_ session:, didAdd anchors:)

or

session (_ session:, didUpdate anchors:)

methods and try to load model for peer node B, it loads and desired 'network' model A is selected correctly, but only at that ARAnchor creates a second instance of the same model for peer B. Apparently this is the wrong way? How to synchronize the display of models for all devices if resource of the model itself is not set as assets in the static files, but is loaded dynamically from local directory?

When entities are synced to a RealityKit app from another peer, file-based resources are resolved based on what files have already been loaded into the app receiving the entities.

This means that the client app must arrange to have already loaded necessary files by the time the multipeer connectivity session begins. This could mean that the entity loaded by your call to Entity.load(named:in:) is already somewhere in the scene… but you probably don't want that, since that would mean that each peer is contributing another entity to the synchronized scene.

Instead, you can load files containing your resources and keep them referenced somewhere in your app's model or controller, without adding them to any ARView. That keeps them loaded, in preparation for an entity arriving via network sync.

One important detail is how these file-based resources are identified across peers. It's straightforward for files in your app's bundle, but for files in other locations on the file system (e.g. those loaded with Entity.load(contentsOf:withName:)), the passed-in name can be used to ensure that the networked entities find the already-loaded resources when they sync over. If the file isn't necessarily present on every peer, your app will have to make arrangements to transfer the file itself. sendResource(at:withName:toPeer:withCompletionHandler:) is a useful mechanism to accomplish that.

(Feedback about documentation, error messages, or the API is most welcome!)