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?

Thanks

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.