Problems with createDefaultVRExperience on Android Chrome

I’ve run into a very specific problem using the VR helper on Android Chrome. Here’s a playground example:

https://playground.babylonjs.com/#LGKN3M

When I use BABYLON.SceneLoader.Load or BABYLON.SceneLoader.Append to load in a .babylon file, all works well. When I call scene.createDefaultVRExperience() on the scene and then click on the VR-goggles icon, it works well on desktop with HTC Vive.

But when I do the same on my Android headset using chrome, it breaks. Here’s the javascript error after pressing the goggles icon on my phone:

In the browser, it looks like this:

When I create a scene from scratch (see playground), I don’t get the same error. It works fine on Android.

Any ideas how to overcome this error?

Thanks.

Pinging @trevordev

Hey @Jacob_Durrant,

I think the issue is due to webVR not being compatable when multiple scenes are active (The one created in the playground and the one created by sceneLoader.load) with only one of them being vr enabled. To fix this, try only having a single scene and load objects into that scene. This can be done by loading an assetContainer and then adding all its contents to the scene. https://playground.babylonjs.com/#LGKN3M#4 Let me know if this doesn’t work for you.

1 Like

Thank you, @trevordev! It works well.