unity-webxr-export
unity-webxr-export copied to clipboard
Subsystem null?
In the XRState, the code was accessing subsystem.xrState. However, in my case (I have no idea why) subsystem was null. This was causing a NullRefEx every frame, and nothing worked. I replaced the existing code with the following as a workaround, but I have no idea if I actually broke anything, since I don't know the origin of the subsystem. Maybe there should be an "Unknown" or "Uninitialized" value in the enum if the subsystem hasn't been instantiated yet?
~D
WebXRManager.cs line 18 changed to the following:
public WebXRState XRState
{
get
{
if (subsystem == null) return WebXRState.NORMAL;
return subsystem.xrState;
}
}
The WebXR Subsystem can't be initialize in the editor, because, well, you are in the editor and not in a supported browser :) But in runtime it does work.
It's a repeating issue. So I guess we should handle it better. For the WebXRController we use the available XR input if we are not in WebGL runtime.
So one option is to try and also emulate the WebXRManager in the editor, and the other is returning stub values like you did.
There's an open source XR mock / emulator for ARFoundation, not sure how things go with what you say and something like that, did test it the other day with some success. https://github.com/coder89/arfoundation-mock
Interesting find @antont , thanks!
Forgot to close this issue when it was fixed (6 months ago).