ImportMeshAsync why the second "then" doesn't work?

I’m trying to show an animation and then do the next action.
But the “alert” happens before the animation

what could be the problem?

the create animation code does not return a promise and you are also not returning a promise in your code so there is nothing to await for before the alert.


Please see this PG:

Animation needs to happen after scene is ready. So it needs to be called in scene.onReadyObservable

Also as sebavan said, CreateAndStartAnimation is not an async function that returns a promise. It accepts a callback function when animation ends. I made a new async function createAndStartAnimationAsync that returns a Promise to resolve the callback of CreateAndStartAnimationI.