Loading screen with total percentage and Promise.all

Good morning,

I have several models to load that I add with ImportMesh, ImportMeshAsync, AssetManager… then I use a custom loading screen to display a percentage progress bar (from 0 to 100%)

But I can’t sum up all the different meshes loaded into the promise.

Each mesh displays from 0 to 100%, but suddenly, the progress bar reaches 100% from the first mesh then returns to 0 with the following mesh.

At the end of all operations, the loading screen clears normally. But I would like to make a total of all the meshes to load and only display a progress from 0 to 100% once.

How to do it ?
I have prepared a PG where all that is missing is the calculation of the percentage of all the loaded meshes.
You can see what’s going on in the console.

Thanks for your help

how is that? prova | Babylon.js Playground (babylonjs-playground.com)


It seems perfect. Thank you very much @RaananW

1 Like

I wonder if this should be somewhere in the doc ?

Yes, I think that might be a good idea.
I searched a lot in the doc, on the forum, in the PGs… But I didn’t find anything relevant on this subject.

We see how to use Promise.all, but nothing with a loading screen and an onProgress total

@PatrickRyan I guess it might be a nice candidate ?

1 Like

@sebavan and @Dad72, yes, this would be a good addition to the docs. I will pull this content into doc and specifically this PG as a code example on the page.

1 Like

Update loading screen docs with new example by PatrickRyanMS · Pull Request #866 · BabylonJS/Documentation (github.com)


THANKS @PatrickRyan !!!

1 Like