# Update the PG of the Documentation DEMOS for Sceneloader ImportMesh, Append

**URL:** <https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815>\
**Category:** Questions\
**Created:** [February 26, 2025, 2:17pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815 "2025-02-26T14:17:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [February 26, 2025, 2:17pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/1 "2025-02-26T14:17:13Z")

</div>

In the import category of PGs and in the PG examples of the documentation, all the sceneloader is marking as Deprecated. I was wondering if it would not be useful to update with the new practice to be used rather than having official examples with noted functions not recommended. If they are not recommended, it should not be in the examples official.

For exemples this PGs :

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#JUKXQD)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

And

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#WGZLGJ)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

I was looking for new practices quickly, and I only found Deprecated functions. So I told myself that it was necessary to submit the ideas of updating all the PG of the documentation.

Thank you

---

<div class="post-metadata">

**Author:** ![Knifepro](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/knifepro/32/39429_2.png) [@Knifepro](https://forum.babylonjs.com/u/Knifepro)\
**Post date:** [February 26, 2025, 2:24pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/2 "2025-02-26T14:24:59Z")

</div>

> [@Dad72](#):
>
> I was looking for new practices quickly, and I only found Deprecated functions. So I told myself that it was necessary to submit the ideas of updating all the PG of the documentation.
> 
> Thank you

First of all, I would like to state that I do not have much knowledge on this subject, but since I also received a similar error, I would like to state that I actually agree with you. Because I also have difficulty finding information text after version changes or updates.

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [February 28, 2025, 12:54pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/3 "2025-02-28T12:54:42Z")

</div>

I will ask the question differently. There is documentation for new imports ? being given that the current one are obsolete.

I can’t find anything anywhere on how to do this.  
The doc Demo should be reviewed, or add PG for example for new practices to adopt.

obsolete :  
` BABYLON.SceneLoader.Append`  
obsolete :  
` BABYLON.SceneLoader.ImportMesh`  
obsolete :  
` BABYLON.SceneLoader.ImportMeshAsync`  
obsolete :  
` BABYLON.SceneLoader.LoadAssetContainer`  
obsolete :  
` BABYLON.SceneLoader.ImportAnimations`  
obsolete :  
` BABYLON.SceneLoader.AppendAsync`

Everything in Sceneloader has become Deprecated. What should be used now to take into account new ways of doing things ? I did not understand and I can’t find any information on it, or an example.

All this documentation is obsolete :

> **[Babylon.js docs](https://doc.babylonjs.com/features/featuresDeepDive/importers/legacy/)**

I found that: (Is that how we should do it ?)

```auto
BABYLON.LoadAssetContainerAsync("scenes/skull.babylon", scene, {
        onProgress: e => {
        
        }
    }).then((result) => {
        result.addAllToScene();
        const mesh = result.meshes[0];
        camera.target = result.meshes[0];

    });

```

I still have a bit of trouble understanding everything. especially on the result.addAllToScene();  
Does that mean that we can add several paths :

```auto
const paths = ["scenes/mesh1.babylon", "scenes/mesh2.babylon", "scenes/mesh3.babylon"]
BABYLON.LoadAssetContainerAsync(paths, scene, {

```

Something like that? I have never used assetcontainer since it exists.

---

<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:** [February 28, 2025, 4:41pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/4 "2025-02-28T16:41:28Z")

</div>

All functions are flagged with their new version:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/1/2/1276a6bfb5a3bc0f579c71d998647b8ee74f8f0c.png)

See the “Please use AppendAsync”

So for this PG: [glTF Loader Demo | Babylon.js Playground](https://playground.babylonjs.com/#WGZLGJ)

the solution is:  
[glTF Loader Demo | Babylon.js Playground](https://playground.babylonjs.com/#WGZLGJ#11069)

That being said, we need to make that doc page clearer and add a link to [Loading Any File Type | Babylon.js Documentation](https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes/)

(cc @PatrickRyan)

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [February 28, 2025, 5:30pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/5 "2025-02-28T17:30:31Z")

</div>

Thank you @Deltakosh for clarification, but how do I replace SceneLoader.ImportMeshAsync ?

Here is my use case. `sceneloader.Importmeshasync` is super simple: you load a mesh, it appears in the scene.  
I charge all the meshes one by one in a loop using : `for (const data of sceneData)` `SceneLoader.ImportMeshAsync`

But with `BABYLON.LoadAssetContainerAsync` or `BABYLON.AppendSceneAsync` this does not work for my use case. Or I didn’t understand like doing it.

Here is what I do. I load my scene from a JSON file which contains the paths of models and metadata to rebuild it. :

```auto
async loadScene(projectName, levelName) {			
	try {
		const response = await $.ajax({
			url: "../Core/PHP/load_scene.php",
			method: "GET",
			data: {
				"project": projectName,
				"filePath": '../../_Projects/' + projectName + '/Data/scene_' + levelName + '.json'
			}
		});

		const sceneData = JSON.parse(response);
		if (utilities.isObjectEmpty(sceneData)) return;

		for (const data of sceneData) {
			const filePath = utilities.getPath(data.source);
			const fileName = utilities.getFile(data.source);

			const result = await BABYLON.SceneLoader.ImportMeshAsync("", filePath, fileName, this.scene);

			const mesh = result.meshes[0];
			
			//...	Other code ...		
		}
	} catch (error) {
		console.error("Error when loading the scene : ", error);
	}
}

```

`LoadAssetContainerAsync` loads all the meshes, but does not load the meshes one by one and `AppendSceneAsync` does the same thing A can ready. Why is there not `BABYLON.ImportMeshAsync` Isn’t it also available to load a model that is added to the scene as simply as possible?

Sorry for my misunderstanding.

---

<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:** [February 28, 2025, 6:01pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/6 "2025-02-28T18:01:01Z")

</div>

> [@Dad72](#):
>
> SceneLoader.ImportMeshAsync

Simply with `BABYLON.ImportMeshAsync()` 🙂

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [February 28, 2025, 6:05pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/7 "2025-02-28T18:05:06Z")

</div>

That’s what I’m looking for it, but does not seem to exist : BABYLON.ImportMeshAsync()

> **[Babylon.js Playground](https://playground.babylonjs.com/#JUKXQD%236217)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [February 28, 2025, 6:32pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/8 "2025-02-28T18:32:24Z")

</div>

I tried to do like that. But it generates an error:

> RuntimeError: Unable to load from …/GameClient/Data/Meshes/Props/Barel.babylon: OK

```auto
for (const data of sceneData) {
    const result = await BABYLON.LoadAssetContainerAsync(data.source, this.scene);	        
    result.addToScene();
    const mesh = result.meshes[0];
}

```

The path of the file exists, but it does not seem to want this load.  
If I do it with:

```auto
for (const data of sceneData) {
    const filePath = utilities.getPath(data.source);
    const fileName = utilities.getFile(data.source);
    const result = await BABYLON.SceneLoader.ImportMeshAsync("", filePath, fileName, this.scene);
    const mesh = result.meshes[0];
}

```

There it works.

And I can’t find BABYLON.ImportMeshAsync() Neither in the doc nor in the PG.

Also this unique example PG with LoadassetContaineSync is in typescript and quite complicated to understand.

> **[Babylon.js Playground](https://playground.babylonjs.com/#C3MP99%2326)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![SimoneDev](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/simonedev/32/44252_2.png) [@SimoneDev](https://forum.babylonjs.com/u/SimoneDev)\
**Post date:** [March 3, 2025, 4:45pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/9 "2025-03-03T16:45:37Z")

</div>

> [@Dad72](#):
>
> I still have a bit of trouble understanding everything. especially on the result.addAllToScene();  
> Does that mean that we can add several paths :
> 
> ```auto
> const paths = ["scenes/mesh1.babylon", "scenes/mesh2.babylon", "scenes/mesh3.babylon"]
> BABYLON.LoadAssetContainerAsync(paths, scene, {
> 
> ```
> 
> Something like that? I have never used assetcontainer since it exists.

As far as I understand, `addAllToScene` allows you to add all entities from your imported scene. On the other hand, `addToScene` allows you to specify a filter function (predicate) to select only the specific entities that satisfy your predicate. Take a look at the following example, it adds all entities except the robot’s body (`entity.name !== 'Box')`:

> **[Babylon.js Playground](https://playground.babylonjs.com/#C3MP99%2329)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

> [@Dad72](#):
>
> Also this unique example PG with LoadassetContaineSync is in typescript and quite complicated to understand.

Can this playground be useful? Basically is the same playground you quoted but with a single mesh (skull) imported with the asset container.

> **[Babylon.js Playground](https://playground.babylonjs.com/#C3MP99%2330)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

* * *

@Deltakosh it seems that `ImportMeshAsync` isn’t exported from `sceneLoader.ts`:

> <https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Loading/sceneLoader.ts#L843>

Unlike other exported functions, it doesn’t belong to a PascalCase wrapper. Could it be missing a wrapper and the corresponding export?

---

<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:** [March 3, 2025, 5:00pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/10 "2025-03-03T17:00:11Z")

</div>

cc @RaananW or @ryantrem who I think worked on that PascalCase story

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [March 3, 2025, 5:08pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/11 "2025-03-03T17:08:38Z")

</div>

Thank you @SimoneDev  
I think I will wait for the availability of importMeshAsync which would be more appropriate for my case. Because I load all the models one by one in a loop and an assetContainer or appendScene does not work for my use case.

---

<div class="post-metadata">

**Author:** ![SimoneDev](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/simonedev/32/44252_2.png) [@SimoneDev](https://forum.babylonjs.com/u/SimoneDev)\
**Post date:** [March 3, 2025, 5:18pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/12 "2025-03-03T17:18:00Z")

</div>

Can you load your scene/mesh (…/GameClient/Data/Meshes/Props/Barel.babylon) in the playground without loop? Or do you have some errors? For instance swapping the resource url here:

> **[Babylon.js Playground](https://playground.babylonjs.com/#C3MP99%2330)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [March 3, 2025, 6:07pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/13 "2025-03-03T18:07:12Z")

</div>

On my project I have mistakes. And with assetconainer we cannot recover the mesh with const mesh = result.meshes[0];

Here is what I had tried:

```auto
async loadScene(projectName, levelName) {			
	try {
		const response = await $.ajax({
			url: "../Core/PHP/load_scene.php",
			method: "GET",
			data: {
				"project": projectName,
				"filePath": '../../_Projects/' + projectName + '/Data/scene_' + levelName + '.json'
			}
		});

		const sceneData = JSON.parse(response);
		if (utilities.isObjectEmpty(sceneData)) return;

		for (const data of sceneData) {
			const filePath = utilities.getPath(data.source);
			const fileName = utilities.getFile(data.source);

			//const result = await BABYLON.SceneLoader.ImportMeshAsync("", filePath, fileName, this.scene);

                const result = await BABYLON.LoadAssetContainerAsync(data.source, this.scene);	        
        		result.addToScene();

			const mesh = result.meshes[0];
			
			//...	Other code ...		
		}
	} catch (error) {
		console.error("Error when loading the scene : ", error);
	}
}

```

And I receive this error in the console:

> Runtimeerror: Unable to load from …/gameclient/data/meshes/props/barel.babylon: OK

Cela fonctionne si j’utilise :  
`const result = await BABYLON.SceneLoader.ImportMeshAsync("", filePath, fileName, this.scene);`

So I think BABYLON.importMeshAsync would better if he could be there.

I cannot create a PG with my model, because I develop my project locally. But the model works properly using BABYLON.SceneLoader.xxx

---

<div class="post-metadata">

**Author:** ![SimoneDev](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/simonedev/32/44252_2.png) [@SimoneDev](https://forum.babylonjs.com/u/SimoneDev)\
**Post date:** [March 3, 2025, 6:59pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/14 "2025-03-03T18:59:08Z")

</div>

Thank you for sharing! From the snippet, I can’t figure out the reason why and the only difference i see is the usage of `filePath` and `fileName` rather than `data.source`, so i thought that:

```typescript
const result = await BABYLON.LoadAssetContainerAsync(filePath+fileName, this.scene);	        

```

would work.

Anyway, it intrigued me because, most of the time, I like to load assets from asset container, do some work (transformations, rotations, etc.) and only at the end show them. This helps me avoid glitches that might occur with `ImportMeshAsync` that shows the asset as soon is loaded. But… the beauty of Babylon.js is that it allows you to do so many things in so many different ways, so keep pushing! 🦾

---

<div class="post-metadata">

**Author:** ![ryantrem](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ryantrem/32/34010_2.png) [@ryantrem](https://forum.babylonjs.com/u/ryantrem)\
**Post date:** [March 3, 2025, 7:17pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/15 "2025-03-03T19:17:31Z")

</div>

When we [switched to the module level functions](https://forum.babylonjs.com/t/sceneloader-and-gltf-options/52853), I tried to update all the docs and Playground examples, but I may have missed some. I will take a look through this thread and make sure we get the other ones updated.

Also when we switched, we didn’t expose an `ImportMeshAsync` module level function because the thought was that `LoadAssetContainerAsync` could do the same thing plus more, so it was redundant to add `ImportMeshAsync`. That said, we’ve heard feedback on this a few times now, so I will go ahead and add this one into the mix as well.

For the issue mentioned above with `LoadAssetContainerAsync`, I will take a look at that as well this week and circle back!

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [March 3, 2025, 8:24pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/16 "2025-03-03T20:24:08Z")

</div>

Thank you @ryantrem to reconsider the `ImportMeshAsync` and to revise the `LoadAssetContainerAsync`.

@SimoneDev In fact `data.Source` in my JSON file, is the full path of the model.  
And `filePath+fileName ` is the same thing but by separating the file and the for the `importMesh` with :

```auto
const filePath = utilities.getPath(data.source);
const fileName = utilities.getFile(data.source);

```

So it comes back to the same if I do:

```auto
const result = await BABYLON.LoadAssetContainerAsync(filePath+fileName, this.scene);
//Or
const result = await BABYLON.LoadAssetContainerAsync(data.source, this.scene);

```

It generates the same error. But maybe this error comes from after. That is to say when I do: Const `mesh = result.meshes [0];` I do not know how a `assetContainer` works, but from what you describe to load the models at the end and to do all the transformation before is interesting too.

---

<div class="post-metadata">

**Author:** ![ryantrem](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ryantrem/32/34010_2.png) [@ryantrem](https://forum.babylonjs.com/u/ryantrem)\
**Post date:** [March 3, 2025, 10:24pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/17 "2025-03-03T22:24:49Z")

</div>

@Dad72 do you have a Playground for the `LoadAssetContainerAsync` issue you are having?

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [March 3, 2025, 10:42pm UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/18 "2025-03-03T22:42:06Z")

</div>

@ryantrem No I have no playground. I develop my project locally.  
But I will try to see if I can’t create one otherwise. I would try to do that tomorrow in the day hoping to reproduce the problem.

---

<div class="post-metadata">

**Author:** ![ryantrem](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ryantrem/32/34010_2.png) [@ryantrem](https://forum.babylonjs.com/u/ryantrem)\
**Post date:** [March 4, 2025, 12:15am UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/19 "2025-03-04T00:15:02Z")

</div>

I have a [PR](https://github.com/BabylonJS/Babylon.js/pull/16245) out to add `ImportMeshAsync` as a module level function (and update doc comments to further help lead folks to the module level functions). That said, from everything you are describing, `LoadAssetConatinerAsync` should work just fine, so I’m definitely curious to see a Playground with a repro!

Also a second [PR](https://github.com/BabylonJS/Documentation/pull/1288) to update the docs and point to updated PGs for the ones you found that use the legacy `SceneLoader`.

---

<div class="post-metadata">

**Author:** ![Dad72](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dad72/32/13_2.png) [@Dad72](https://forum.babylonjs.com/u/Dad72)\
**Post date:** [March 4, 2025, 1:32am UTC](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815/20 "2025-03-04T01:32:45Z")

</div>

@ryantrem I tried to make a PG before going to bed. I can’t reproduce the problem. But I see another.

If you look at this PG you will see that with `BABYLON.LoadAssetContainerAsync`, the brightness increases sharply. (The meshes are much white)

Make a comment on line 47 and you will see the difference using BABYLON.SceneLoader.ImportMeshAsyn then BABYLON.LoadAssetContainerAsync

> **[Babylon.js Playground](https://playground.babylonjs.com/#C3MP99%2332)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

I would continue tomorrow to try to understand what to create a problem on my project.

[Next page](https://forum.babylonjs.com/t/update-the-pg-of-the-documentation-demos-for-sceneloader-importmesh-append/56815.md?page=2)
