Uncaught ReferenceError for BABYLON.Scene.CreateDefaultVRExperience on non-VR machine

The following page throws an Uncaught ReferenceError when loaded on a machine that is not capable of a proper WebVR experience (due to f.e. lacking a valid headset).

It uses the latest preview of Babylon, and appears to have been introduced around 8 hours ago (as of writing) in Commit 6c006a. The full stacktrace points to this line.

I cannot seem to get a repro case in the BJS Playground - perhaps a difference between versions that the Playground uses and elsewhere?

<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Babylon.js Uncaught</title>

    <!-- Babylon.js -->
    <script src="https://code.jquery.com/pep/0.4.2/pep.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
    <script src="https://preview.babylonjs.com/ammo.js"></script>
    <script src="https://preview.babylonjs.com/cannon.js"></script>
    <script src="https://preview.babylonjs.com/recast.js"></script>
    <script src="https://preview.babylonjs.com/Oimo.js"></script>
    <script src="https://preview.babylonjs.com/gltf_validator.js"></script>
    <script src="https://preview.babylonjs.com/earcut.min.js"></script>
    <script src="https://preview.babylonjs.com/babylon.max.js"></script>
    <script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script>
    <script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script>
    <script src="https://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script>
    <script src="https://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script>
    <script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script>
    <script src="https://preview.babylonjs.com/serializers/babylonjs.serializers.min.js"></script>
    <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script>

        body {
            overflow: hidden;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;

        #renderCanvas {
            width: 100%;
            height: 100%;
            touch-action: none;

    <canvas id="renderCanvas"></canvas>
        var canvas = document.getElementById("renderCanvas");
        var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
        var scene = new BABYLON.Scene(engine);
        var vrhelper = scene.createDefaultVRExperience();  // BUG STARTS HERE

        engine.runRenderLoop(function () {
            if (scene) {

        // Resize
        window.addEventListener("resize", function () {


Pinging @RaananW


can I ask what browser are you using?
I checked thoroughly before doing that, DeviceOrientationEvent is defined in every browser we are supporting - DeviceOrientationEvent - Web APIs | MDN. Or is it…

I just need to understand if it is undefined, or if there is any other problem.

My apologies for the delay - it was from Google Chrome Version 78.0.3904.108. About Chrome reports it as up to date.

I will test that soon. do you mind creating a github issue and assign me?

1 Like

Issue 7253 has been created, but I don’t believe I have the permission to assign you to it.

1 Like