Preloading assets

Currently when a scene is loaded, or a GameObject instantiated, the object will “pop in” to RealityKit several frames later, and asynchronously compared to other objects loaded/created at the same time.

Is there any way at the moment to do any of the following:

  • Presubmit a GameObject or mesh/material/textures to be readied on RealityKit, so that when it’s needed it can be enabled/instantiated predictably in a single frame?
  • A way to poll whether the loading of above asset preparation is complete?
  • A way to poll whether there are any assets currently being prepared because of scene load or instantiation?


We definitely have it on our road map to preload shader graphs, as well as to have some way of providing a customizable “loading screen” or equivalent (that would give progress reports on loading). In that case, though, we’re using an async API (ShaderGraphMaterial.init) that reports to us when finished. For general assets (meshes, textures), I’m not sure we have a way to know when they’re loaded in the renderer thread, though perhaps it would help if we used the asynchronous APIs for those as well (despite initializing them from data in-memory in all cases). That’s something we could ask Apple about.

I don’t think there’s any great way to do it at the moment.

1 Like

Could you expose an API for submitting mesh/texture resources as if they were required by a GameObject, without (for now) any indication of when they’re ready? At least that way we could insert a manual delay and then be reasonably confident that objects spawn in or enable instantaneously.

Yeah, I think something like this sounds reasonable; I will make a note to bring it up with the team.

I’m running into the issue of having parts of a very detailed 3D model pop in over several frames. Was anything done to mitigate this? Any workarounds currently being used to load models without displaying them until they’re ready?

Not yet, but it’s something we’d like to get started on soon. However, I believe that part of the issue (with meshes specifically) is on Apple’s side. We set the mesh data (synchronously) in a ModelComponent, but that has to transfer over to the rendering thread, and that process happens asynchronously and without any feedback to let us know that the model is ready to show. It might help to mention this issue to Apple via their Feedback Assistant and request either or both a way to make scene updates in transactions (so that all models are updated at the same time) and/or a means to be notified when a mesh is ready to show on the render thread (that way, we can transfer the model as invisible, then make it visible when everything is ready).

1 Like

Thanks :slight_smile:
I’ve submitted feedback to Apple.
In the meantime, I’ve managed to work around this by displaying the model for a single frame, then quickly hide it. After waiting approx. 3 secs, I can then turn on the entire model again without the ugly pop-in. So far, this is working with the model that was giving me trouble, but that’s obviously not an ideal way to solve the issue in general.

1 Like