Import Mesh Only For Specific Meshes, Not All

So my .gltf files is getting bigger and bigger, and this will slow down the loading process, especially if I updated the file, the user has to download the file again without using the cache (because it is updated). I tried using ImportMesh and only choose specific meshes to download not all of the file.

When I run the program. Actually it loads all the meshes at the first import. I want to only load 1 or 2 meshes at initialization.

How can I achieve this?

https://doc.babylonjs.com/how_to/load_from_any_file_type#sceneloaderimportmesh

First parameter,
“” ---- all meshes
“mymesh” — named mesh
Array of mesh names ---- for more than one mesh

2 Likes

I did this, but the actual process that happens is it will load all the files at the first time.

I check the total load of the file is 2MB, this includes about 9 meshes. When I just import 7 meshes, it loads 2MB at first, then when I load the other 2 meshes, each mesh is loaded super fast, it loads from cache.

Babylon cannot load a part of the file that contains all meshes. It can only load the entire file and then filter from the file itself after loading the entire thing.

You can export the meshes differently, to get a better delivery (individual meshes in different files, for example)

2 Likes

Ohh this is unfortunate. Then whats the point of ImportMesh if it downloads all of them at once?

Any how thank you

The reason is not to help with download here but mainly with what you instantiate in your scene.