- Home /
go to other scene at the end of animation
Hy everyone.
I have a little problem.
I'm in scene 1 and there is playing an animation. But what i want is; if the animation is finished with playing, that he automatically needs to go to scene 2 without tab a key or something else.
(go to other scene at the end of an animation, 2 secs after the end of an animation).
thnx
Answer by efge · Mar 01, 2011 at 10:24 PM
In JS your script could lokk something like this:
animation.Play(animation.clip.name);
yield WaitForSeconds (animation.clip.length + 2);
Application.LoadLevel (1);
Play the animation, wait till the end of the clip plus two seconds and load the next scene (assuming scene 1 is your first scene).
Remember: yield can only be used in a coroutine.
Answer by Ilias · Mar 01, 2011 at 10:55 PM
Hey thnx it works, but sorry, i was forgotten an other question it looks like this question; how can i fade in/out it to the other scene?
you gave me this
animation.Play(animation.clip.name);
yield WaitForSeconds (animation.clip.length + 2);
Application.LoadLevel (1);
And how can i made it as an extra to fade in/out?
please can you help me?