"new BABYLON.Texture()" as promise

When I execute a
var texture = BABYLON.Texture(...);
I would like to receive a promise (to work with await/async).
Is there a workaround for this? I’ve already tried the onLoadObservable and the parameter in the constructor. But I can’t get any further.

Thank you!

Hi,

Look at GetAsyncTexture() line 47 here : https://www.babylonjs-playground.com/#DXARSP#30

Babylon includes a polyfill for Promise so you can use them safely but be carefull with async/await since it’s not yet supported by all browsers :

3 Likes

Thank you! =)