When I enable webGPU engine and enter immersive mode on Meta Quest 2 I get this error:
chunk-KKQIXIMS.js?v=05008350:14743 Uncaught (in promise) TypeError: Unhandled Promise Rejection: Cannot read properties of null (reading ‘makeXRCompatible’)
For some reason this.canvasContext is null.
async initializeXRLayerAsync(xrSession) {
const createLayer = () => {
this.xrLayer = new XRWebGLLayer(xrSession, this.canvasContext, this._options.canvasOptions);
this._xrLayerWrapper = new WebXRWebGLLayerWrapper(this.xrLayer);
this.onXRLayerInitObservable.notifyObservers(this.xrLayer);
return this.xrLayer;
};
if (!this.canvasContext.makeXRCompatible) {
return Promise.resolve(createLayer());
}
return this.canvasContext.makeXRCompatible().then(
// catch any error and continue. When using the emulator is throws this error for no apparent reason.
() => {
},
() => {
Tools.Warn("Error executing makeXRCompatible. This does not mean that the session will work incorrectly.");
}
).then(() => {
return createLayer();
});
}