Circumstances in which loadAsync doesn't work

Hey,

what are circumstances in which

 assetsManager.loadAsync()

may not work?

I am really puzzled since the promise i get when calling this method has state “Pending” forever and none of the “then” handlers are triggered.
The assetsManager.load() works like a charm though.

Here’s the code:


    187   addTask(name, meshSubdir) {    
    188     let self = this;                                                               
    189     let load_path = DATA_FILES + "/" + meshSubdir + "/";                            
    190     let meshTask = this.assetsManager.addMeshTask("task_" + name, "", load_path, name + '.babylon');
    191     this.tasks[name] = meshTask;                                                             
    192                                                    
    193                                                     
    194     meshTask.onSuccess = function (task) {                                                  
    195         const scale = MESH_SCALING[meshSubdir];                                              
    196         let loadedMesh = meshTask.loadedMeshes[0]    
    197         loadedMesh.scaling = new BABYLON.Vector3(scale, scale, scale)
    198         loadedMesh.isVisible = false;                                       
    199         self.meshes[name] = loadedMesh;
    200         self._recomputeScene();                                  
    201         console.log('DEBUG: model:' + name + ' loaded successfully');
    202       }                         
    203     meshTask.onError = function (task, message, exception) {         
    204       console.log('EXCEPTION: Mesh with name ' + name + ' not loaded:', message, exception)      
    205     }                            
    206                                                                      
    207     console.log('DEBUG: Added ' + meshTask.name + ' to task asset manager' );             
    208     let promise = this.assetsManager.loadAsync();                                          
    209     promise.then(function (tasks) { console.log(tasks)});                                         
    210                                                                                                                                                         
    211  }

It should work the same. Can you repro in the Playground?

Ok found the problem, here is the code from plagroudn for loadAsync:

            e.prototype.loadAsync = function() {
                var e = this;
                return new Promise(function(t, i) {
                    e._isLoading ? t() : (e.onTasksDoneObservable.addOnce(function(e) {
                        e && e.length ? i(e) : t()
                    }),
                    e.load())
                }
              

Here is the code in my local version (which is downloaded from cdn.babylon)

loadAsync = function () {
        let e = this;                                    
        return  new Promise(function(t, i) {                                 
            e.onTasksDoneObservable.addOnce(function(e) {      
                e && e.length ? i(e) : t()                     
         })                                                                         
 })

I’ve checked second time indeed the code looks like it when downloaded from [https://cdn.babylonjs.com/babylon.max.js](http://babylon cdn)

Should it be the case? Which code is right? Surly the code from latest version (from CDN) doesn’t give expected results.
I would say it’s a bug.
Playground code (older) works.

Do you mind sharing the repro link?