#Coroutine is not playing properly in order

1 messages · Page 1 of 1 (latest)

quartz axle
#

So my coroutine should play animation then wait then load new scene it looks like this
IEnumerator LoadLevel(int levelIndex)
{
Animator.SetTrigger("trigger") ;
yield return new WaitForSeconds(time);
SceneManager.LoadScene(levelIndex);
}
But what it does is it first waits then loads new scene and after that it plays the animation and I dont know how to play it in correct order. Please help.

acoustic glen
#

Increase the value of the time variable

quartz axle
quartz axle
fathom sandal
#

You want LoadSceneAsync

#

You want to load the new scene, then play your animation and wait, and then after some amount of time you can then make the transition to the new scene

quartz axle
fathom sandal
#

Just gave you the answer, you'll have to figure it out from there

quartz axle
#

Ok guys I have no clue what I did but it's working. Thanks guys for your effort in helping me. 🙂

shy lintel
#

Were you calling it using the StartCoroutine() function before?

quartz axle
#

Yep

thick leaf
quartz axle
#

Looks cool thanks man.

fathom sandal