Just updated from 3.1 to 4.0 and all loading with AssetManager are broken.
https://playground.babylonjs.com/#Y7XMAR#28 here the link to reproduce the bug. Change isUsingPromise
to see different behavior. Expected same behavior.
I use promises to load AssetManager. Promises in js is always async.
Promise.resolve().then(() => console.log(1)); console.log(2);
will produce 2,1
In the line assetsManager.ts#L1009 you can see splicing tasks array.
Here is what happening.
- AssetManager.onFinish calls with all tasks
- Next promise in chain is scheduled by browser with all tasks
- AssetManager._decreaseWaitingTasksCount - removing successful tasks (Why? Second call AssetManager.load?)
- Function in Promise.then fires with empty array of tasks