Pausing imported animations.

Hey guys! I have been struggling with pausing an animation for the past couple days. I imported the animation and am using Legacy Animation Type. I read a bunch of threads suggesting to use

GetComponent().enabled = false;
GetComponent().enabled = true;

While this does freeze the animation, when it is toggled back to true the animation skips ahead the amount of time it was paused for.

All ideas are welcome!

1 Answer

1

I ended up getting and storing the time, along with using Stop() and Play()

public GameObject Text_ANIM;
public Animation ANIM;
public float AnimTime; 

   if(!AnimStarted)
            {
                AnimTime = ANIM["TextAnimation"].time;
                Text_ANIM.GetComponent<Animation>().Stop();
                AnimStarted = true;              
            }
        else
            {
                Text_ANIM.GetComponent<Animation>().Play();
                ANIM["TextAnimation"].time = AnimTime;
                AnimStarted = false;
            }