# Babylon Lite: Make \`removeFromScene()\` symmetric with \`addToScene()

**URL:** <https://forum.babylonjs.com/t/babylon-lite-make-removefromscene-symmetric-with-addtoscene/63710>\
**Category:** Bugs\
**Created:** [June 28, 2026, 2:12pm UTC](https://forum.babylonjs.com/t/babylon-lite-make-removefromscene-symmetric-with-addtoscene/63710 "2026-06-28T14:12:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [June 28, 2026, 2:12pm UTC](https://forum.babylonjs.com/t/babylon-lite-make-removefromscene-symmetric-with-addtoscene/63710/1 "2026-06-28T14:12:52Z")

</div>

`addToScene()` accepts several entity types:

```ts
addToScene(
  scene: SceneContext,
  entity:
    | Camera
    | Mesh
    | SceneNode
    | LightBase
    | ShadowGenerator
    | AssetContainer,
): void;

```

But `removeFromScene()` does not appear to support the same set of types.

This makes the API asymmetric: if an app can add an entity/container with `addToScene()`, it should also be able to remove the same thing with `removeFromScene()`.

## Expected API

```ts
removeFromScene(
  scene: SceneContext,
  entity:
    | Camera
    | Mesh
    | SceneNode
    | LightBase
    | ShadowGenerator
    | AssetContainer,
): void;

```

Or, if some types should not be removable, the difference should be explicit and documented.

## GLB use case

`loadGltf()` returns an `AssetContainer`:

```ts
const container: AssetContainer = await loadGltf(engine, url);

addToScene(scene, container);

// Later:
removeFromScene(scene, container);

```

Currently, there is no clear public way to fully remove/dispose everything added from the loaded container.

## Expected behavior for `AssetContainer`

When removing an `AssetContainer`, `removeFromScene()` should undo what `addToScene(scene, container)` did:

- recursively remove `container.entities`
- dispose/free mesh GPU resources where applicable
- unregister container animation groups
- unregister related render/update callbacks
- remove container-owned lights/camera/shadow generators if they were added
- clean skeleton/material variant metadata if applicable
- be safe to call more than once

## Request

Please make `removeFromScene()` symmetric with `addToScene()`, especially for `AssetContainer`, so loaded GLB/GLTF models can be safely unloaded.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [June 29, 2026, 3:52pm UTC](https://forum.babylonjs.com/t/babylon-lite-make-removefromscene-symmetric-with-addtoscene/63710/2 "2026-06-29T15:52:36Z")

</div>

Love the suggestion do you want to PR it ? let s see what @ryantrem and @RaananW think

---

<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:** [June 29, 2026, 3:53pm UTC](https://forum.babylonjs.com/t/babylon-lite-make-removefromscene-symmetric-with-addtoscene/63710/3 "2026-06-29T15:53:40Z")

</div>

Oh, i am already working on that in the background 🙂

PR is already open - [feat(scene): make removeFromScene symmetric with addToScene by RaananW · Pull Request #337 · BabylonJS/Babylon-Lite · GitHub](https://github.com/BabylonJS/Babylon-Lite/pull/337)
