- Home /
The question is answered, right answer was accepted
Playing one animation after another, JS
Hey guys, I did a search and couldn't find anything out there that made sense to my situation.
All I'm trying to do is get one animation to play, stop, then play another animation...all with in a function within JS.
function Intro ()
{
speed = 0.4;
animation.Play("IntroWalk");
yield WaitForSeconds (2);
speed = 0;
animation.Stop();
animation.Play("IntroIdle");
PlaySound (sayHello, 0);
yield WaitForSeconds (5.1);
}
What I'm expecting to have happen here;
play the walk animation for 2 seconds, stop, then play the idle animation.
What actually happens;
plays the walk animation for 2 seconds, gets frozen in the first frame of the idle animation.
I am confused here. Any clarification as to why this won't work?
Never$$anonymous$$d, I figured it out. I added each animation to a boolean statement under the update, and then I turn them on/off as needed.
You have many options to acieve what you want but i'll describe 2:
1-> ins$$anonymous$$d of using yield waitforseconds you can make timeDelay variable add it into actual Time.time and if this actual Time.time is equal or greater than your delayed time -> switch animation (it's the easiest way in my opinion).
2-> you can use animator and trigger actions through events or count how lojgthis animation should play to start another one etc.
Follow this Question
Related Questions
Play animation when transform is moving? [JS] 0 Answers
User Created Animations Not Working With Mecanim 0 Answers
Animated camera problems 0 Answers
Setting Scroll View Width GUILayout 1 Answer