Home > Blockchain >  How to stop an animation in animator from playing without disabling it
How to stop an animation in animator from playing without disabling it

Time:04-24

What code to write for it to stop playing for example I want animatorz.Play("Jump"); and I want to stop it how? Also I already tried to make a empty state in anim but it just plays both of them.

CodePudding user response:

Method 1: Somewhat complicated

Play the animation first:

animation.Play("Jump");

Pause the jump animation:

pausetime=animation["Jump"].time;

animation["Jump"].Stop();

Continue jumping animation:

animation["Jump"].time=pausetime;

animation.Play("Jump");

Method 2: Very simple

Play the animation first:

animation.Play("Jump");

Pause animation:

animation["Jump"].speed=0;

Continue the animation:

animation["Jump"].speed=1;

  • Related