AssetManager loadAsync() not implemeneted?

I was having trouble using the loadAsync method of the AssetManager and I glanced at its implementation:

    AssetsManager.prototype.loadAsync = function () {
    var _this = this;
    return new Promise(function (resolve, reject) {
        _this.onTasksDoneObservable.addOnce(function (remainingTasks) {
            if (remainingTasks && remainingTasks.length) {
                reject(remainingTasks);
            }
            else {
                resolve();
            }
        });
    });
};
return AssetsManager;

Its implementation is basically empty. It just waits for each task to complete and then resolves when they’re all complete, except unlike the .load() implementation it never actually starts the load so I don’t see how this could ever work.

Seems this has been fixed in the latest version Babylon.js/assetsManager.ts at 475ccd6d80ea3ca47ee333a7becf189106f873cd · BabylonJS/Babylon.js · GitHub

1 Like

Wow you’re right. I guess I’ll hack it up while I wait for this version to come to me in npm land. Thanks!

You can already get it via npm if you refer to one of the tagged alpha builds e.g. 4.1.0-alpha.27

1 Like