Missing property in sample code

The samples in question are WebVR Lab and WebVr Orange Room. Recently, when launching these from the editor, an error message is displayed:

[web-vr-ui.js?id=6076849&branchId=2377bd1c-2001-4f78-9f0c-62cc0bee56fb:76]: Cannot read property 'isSupported' of null

TypeError: Cannot read property 'isSupported' of null
    at onEnterVrPressedEvent (https://launch.playcanvas.com/api/assets/files/scripts/web-vr-ui.js?id=6076849&branchId=2377bd1c-2001-4f78-9f0c-62cc0bee56fb:76:33)
    at script.WebVrUi.initialize (https://launch.playcanvas.com/api/assets/files/scripts/web-vr-ui.js?id=6076849&branchId=2377bd1c-2001-4f78-9f0c-62cc0bee56fb:102:9)
    at ScriptComponent._scriptMethod (https://code.playcanvas.com/playcanvas-stable.dbg.js:27162:21)
    at ScriptComponent._onInitialize (https://code.playcanvas.com/playcanvas-stable.dbg.js:27180:16)
    at ScriptComponentSystem._callComponentMethod (https://code.playcanvas.com/playcanvas-stable.dbg.js:27580:51)
    at ScriptComponentSystem._onInitialize (https://code.playcanvas.com/playcanvas-stable.dbg.js:27585:10)
    at Function._helper (https://code.playcanvas.com/playcanvas-stable.dbg.js:24278:14)
    at Function.initialize (https://code.playcanvas.com/playcanvas-stable.dbg.js:24281:10)
    at Application.start (https://code.playcanvas.com/playcanvas-stable.dbg.js:23704:24)
    at https://launch.playcanvas.com/editor/scene/js/launch.js:7241:25

Tested in Chrome, Windows 10, no VR hardware connected.

1 Like

I’m having the same problem here, would like to know if there’s a solution from Playcanvas or if you figured something out yourself?

@dbirchinall I noticed today that the problem had been fixed in the samples. If I’m not mistaken, the solution is to add the same polyfill scripts (scripts/contrib/webvr-polyfill.min.js and scripts/webvr-polyfill-init.js) present in the WebVR Lab sample. Add these assets to your project and make sure that they are at the top of the “Scripts loading order” list, found under project settings. Hope this helps.

2 Likes

Ah you genius thank you!

Works on desktop but getting very inconsistent results on mobile now and an error “Failed to recalculate device parameters” - also on iPhone the gyro just doesn’t work!

Awesome! I’m hoping an official representative can elaborate a bit on the subject, but in the meantime the samples should hold some answers.

I just wiped playcanvas data from the safari app on my iphone and now gyro works (still getting errors but it seems to function)

Not the smoothest of integrations but it’s something.

Thanks for the steer on this, saved my bacon!

1 Like