Feature request Could we make the load function from assetsManager compatible with await?

#1

Hello,

I’m not sure if I’m making it right or not but how can we use async await with this ?
I tried it be it makes my code not working.

Is this implemented or will it ask some work to be done ?

#2

The scene loader is async await compatible (Promise based),
Maybe that is what you are looking for?

https://doc.babylonjs.com/api/classes/babylon.sceneloader#importmeshasync

#3

I’m not sure I could use completely this.

Internally I use addMeshTask & addMeshTask to load every assets I have.

#4

I can definitely add some promises on the AssetsManager.
Do you want something like that?

await assetManager.loadAsync()
1 Like
#5

That would be perfect !

#6

Would you be kind to open an issue on our repo detailing all the xxxAsync functions you would like on the AssetsManager?

I could work on it this week

#7

Sure, here is the issue : Feature Request - make assetsManager await compatible · Issue #5937 · BabylonJS/Babylon.js · GitHub

I’m not sure we would need more async function from the assetManager.

#8

I will work on that already :slight_smile:

#9

How does it work?
I dont succeed to get it to run here:
https://www.babylonjs-playground.com/#ZJYNY#144

#10

Woot! this is a big bug!!! I’ll fix it for net nightly

Thanks for the heads up!

#11

thanks :smiley: