I want to get your opinion on something. Imagine that you have a 50+ small gltf file. I’m pulling them from the json file with foreach and adding them to the scene with importmesh. Meshes do not load in order because they are different in size. It’s getting mixed up on scene. But I want the mesh in order.
How do I load cages in order? Is there anyone have an idea?
If you can’t use await/async, you can also chain promises in a for loop.
var promise = Promise.resolve();
for (var i = 0; i < 10; i++) {
promise = promise.then(function () {
return BABYLON.SceneLoader.AppendAsync(...);
});
}
promise.then(function () {
// do something at the end
});