# Augmented reality in my localhost

**URL:** <https://forum.babylonjs.com/t/augmented-reality-in-my-localhost/7239>\
**Category:** Questions\
**Created:** [November 27, 2019, 8:17am UTC](https://forum.babylonjs.com/t/augmented-reality-in-my-localhost/7239 "2019-11-27T08:17:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![issam\_abdelhedi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/issam_abdelhedi/32/5064_2.png) [@issam\_abdelhedi](https://forum.babylonjs.com/u/issam_abdelhedi)\
**Post date:** [November 27, 2019, 8:17am UTC](https://forum.babylonjs.com/t/augmented-reality-in-my-localhost/7239/1 "2019-11-27T08:17:17Z")

</div>

Hello ,  
if i test this in the playgroud it’s work fine [https://www.babylonjs-playground.com/#BCU1XR#804](https://www.babylonjs-playground.com/#BCU1XR#804)  
but if i download it and try to work with it i get this problem 😕

 ![bug-Xr-Local](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/f/faebf06a714d008b91e9f8787ec65475f9fd6ff7.png)

Thnaks for help 🙂

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 27, 2019, 8:34am UTC](https://forum.babylonjs.com/t/augmented-reality-in-my-localhost/7239/2 "2019-11-27T08:34:44Z")

</div>

Yeah, this is due to the async nature of scene creation in the demo.

In the last lines of the html file you downloaded, you can find those lines:

```auto
scene = createScene();
        
        

        engine.runRenderLoop(function () {
            if (scene) {
                scene.render();
            }
        });

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

```

change that to:

```auto
createScene().then((scene) => {
        engine.runRenderLoop(function () {
            if (scene) {
                scene.render();
            }
        });

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

```

This should work.

You can read about async await and maybe implement it a bit better if you want 🙂

---

<div class="post-metadata">

**Author:** ![issam\_abdelhedi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/issam_abdelhedi/32/5064_2.png) [@issam\_abdelhedi](https://forum.babylonjs.com/u/issam_abdelhedi)\
**Post date:** [November 27, 2019, 8:47am UTC](https://forum.babylonjs.com/t/augmented-reality-in-my-localhost/7239/3 "2019-11-27T08:47:40Z")

</div>

thannnnkks @RaananW 😃
