0
\$\begingroup\$

How do you stop an animation and then resume on the same frame where you paused? I tried:

if (paused) {
    anim.speed = 0;
} else {
    anim.speed = 1;
}

Sure, it pauses and plays but it doesn't resume on the frame it paused. It starts over the animation. I also tried playing around the Speed field in Animator (instead of via code) while the animation is playing and its the same way. When the animation is playing and I change the value of Speed, the animation doesn't slow down, it gets reset.

\$\endgroup\$
  • \$\begingroup\$ Do you need an Animator component for this case, with its graph control logic? Or would an Animation component serve your needs? \$\endgroup\$ – DMGregory Oct 12 at 10:49
  • \$\begingroup\$ Hi, I found out the problem. I tried creating from scratch and removing any extra and the anim.speed is actually working. I found out that I had extra state transitions happening in my original project that's why the animation was resetting. \$\endgroup\$ – g_b Oct 13 at 1:42
0
\$\begingroup\$

I found out my problem. I tried creating from scratch and removing any extra and the anim.speed is actually working. I found out that I had extra state transitions happening in my original project that's why the animation was resetting.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.