XR support not working in new project

I am trying to bring over the XR functionality from the VR Starter Kit project, but noticed quite quickly that it’s not working at all, and it seems to be because the new project is not registering as supporting XR.

If I log to the console:

console.log('XR supported: ' + this.app.xr.supported);

Inside the VR Starter Kit project, this outputs ‘true’, but in my new project, this outputs ‘false’. I am running everything in the same browser. So I have no idea why this new project is marked as not supporting XR.

Here is the test project: https://playcanvas.com/editor/project/721636

Is there some setting I’m missing to enable XR?

What device are you testing on? Is your project a fork of the Starter Kit project?

Testing on Windows 10 / Vive Pro. Works perfectly for the VR Starter Kit, as I said.

My project is a totally clean project, not a fork.

Have you got the polyfill files from the Starter Kit project?

Yes, I copied those over, and put them in the same loading order, so they load before anything else.

Ah, I think I know what the issue is:
From the VR starter project

The polyfill and the patch needs to be loaded before the engine which can be changed on the asset inspector/settings of those files.

Boom! That was it, thanks so much for your quick help!

1 Like

You may want to enable the native WebXR API via the browser flags as the polyfill can get outdated?

OK, thanks!