unity-webxr-export: Page freezes when unloading and reloading Unity instance

It’s normally possible to reload Unity on a running webpage by unloading the current instance (using gameInstance.Quit()) and then loading a new one (using UnityLoader.instantiate as usual) in a callback. However, as soon as I include the webxr.js from this project in the page, this reload completely freezes the page. I suppose there’s an issue with the XRManager where it doesn’t know how to deal with this program state and doesn’t correctly switch over to the new instance. And as far as I can tell, XRManager doesn’t expose any methods to shut it down (let alone create a new one, since the type and initWebXRManager methods are not exposed by the module).

Is there an easy way to work around this issue? Otherwise it would be great if the project could support instance reloads out of the box.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Alright, after a few more builds and also clearing out all of the old build files instead of just overwriting them, it works again. Sorry for the false alarm. I’ll test reloading the Unity instance in a bit and let you know if that works now.

I did, but I’m using a custom template. As far as I can tell from your commits though, all you did was delete those script tags and remove the JS files, which I’ve done with my custom template as well. I’ll give it a spin with one of your templates though to make sure the template is not the issue.

It can be today, and it can be in a few weeks. I’m actually testing this now, but I have some issues with “downgrading” ES6 code to ES5, as Unity use old JavaScript Uglify to minimize code.