New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page freezes when unloading and reloading Unity instance #115
Comments
Interesting. I'm planning to insert |
Do you have a rough timeframe for that change? Just so I can better judge how much effort to put into a workaround. |
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. |
Seems like I solved my issues. Need to test this on some devices. It'll be this weekend. I'm not sure if it'll solve your issue, you'll have to try it. |
I'll give it a shot next week. If you're going to release a new version by then anyway, don't worry about a separate branch now. |
Ok, it's in PR. I'll test it more later this weekend. |
Thanks for addressing this so quickly. I just updated the package, but unfortunately it seems to have broken WebXR for me. If I try to go into WebXR through the Oculus Browser on the Quest, it just loads indefinitely. If I try it in Chrome (with the Quest connected via Oculus Link), the button doesn't seem to do anything in the browser, but inside the Quest it still seems to try and load something (and if I abort that loading inside the Quest, Chrome crashes). Your live demo does work for me though. I don't think I changed anything except remove the webxr.js and gl-matrix |
Try to delete the old WebGLTemplates and copy again from the |
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. |
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 do wonder which files you didn't clear |
Hm, it doesn't look like that fixed it. The page still freezes when quitting and reloading the Unity instance. I'm not sure to what degree the JS plugin's lifetime is actually scoped to the Unity instance's. I'll look into this further tomorrow and see if adding a bit of a delay might help for it to clean up everything, but it might be helpful if the WebXR plugin either shut itself down when Unity quits, or could listen to an event to shut itself down manually. |
My guess is that although the code is now scoped in the Unity Instance Module, it's still listening and dispatching to the document custom events. You can look at |
Are you planning to make these changes to the plugin itself? Unfortunately, I currently don't have the bandwidth to understand the code well enough to make these changes myself and be sure I didn't break anything. |
I plan to do it, but it'll take time. |
I opened a thread in the Unity WebGL forum about that |
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 (usingUnityLoader.instantiate
as usual) in a callback. However, as soon as I include thewebxr.js
from this project in the page, this reload completely freezes the page. I suppose there's an issue with theXRManager
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 andinitWebXRManager
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.
The text was updated successfully, but these errors were encountered: