# How to Clean Scene

**URL:** <https://forum.babylonjs.com/t/how-to-clean-scene/2815>\
**Category:** Questions\
**Created:** [April 27, 2019, 4:26am UTC](https://forum.babylonjs.com/t/how-to-clean-scene/2815 "2019-04-27T04:26:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![James](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@James](https://forum.babylonjs.com/u/James)\
**Post date:** [April 27, 2019, 4:26am UTC](https://forum.babylonjs.com/t/how-to-clean-scene/2815/1 "2019-04-27T04:26:09Z")

</div>

In other words, I want to destroy everything in scenes, such as light camera mesh and so on. Because I need to update the scene when the mesh rootUrl changes.

For example, this is an example of babylonjs.

```auto
// https://www.babylonjs-playground.com/#UKNERM#0

var createScene = function () {
    var scene = new BABYLON.Scene(engine);

    //Adding a light
    var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);

    //Adding an Arc Rotate Camera
    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0.8, 100, BABYLON.Vector3.Zero(), scene);
    camera.attachControl(canvas, false);

    // The first parameter can be used to specify which mesh to import. Here we import all meshes
    BABYLON.SceneLoader.ImportMesh("", "scenes/", "skull.babylon", scene, function (newMeshes) {
        // Set the target of the camera to the first imported mesh
        camera.target = newMeshes[0];
    });

    // Move the light with the camera
    scene.registerBeforeRender(function () {
        light.position = camera.position;
    });

    return scene;
}

```

After a while, the rootUrl of mesh may not be “scenes /”, for example “static /”, How can I update scene?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 27, 2019, 12:45pm UTC](https://forum.babylonjs.com/t/how-to-clean-scene/2815/2 "2019-04-27T12:45:02Z")

</div>

hello and welcome,  
the idea here would be to dispose the scene (scene.dispose()) and create a new one.
