- Home /
Time.timeScale=0 after Animation
Hi all,
i have a sliding in pause Menu. I click the options Button and then i call
public void PauseGame()
{
Time.timeScale = 0;
}
Problem is, it wont slide in because the animation is instandly stopped from that. What's best way to fix this? A Coroutine?
Thanks in advance.
Answer by OctoMan · Jun 22, 2015 at 04:00 PM
To fix this, i use the eventsystem inside the animation window, so once the animation has ended, i call the scriptfunction i was writing in the first post. This will end the animation and will pause all after this.
I just needed to add the script onto the object where the animation on.
Answer by Baste · Jun 22, 2015 at 02:30 PM
Coroutines stop being invoked if timeScale is zero.
If you're animating with an Animator (not an Animation component), you can set the Animator to use Unscaled Time as it's update mode. That'll make it not care about the timeScale:
Animator myAnimator = GetComponent<Animator>();
myAnimator.updateMode = AnimatorUpdateMode.UnscaledTime;
That's very ideal for things like pause menus. If you're using an Animation component, well, now's the time to read up on Animators.
I'm using an animation component, so this wont work. I decided to use the animation eventsystem, quick and dirty. Still thanks.
Your answer
Follow this Question
Related Questions
Create an Avatar (for Animator) for UI? 0 Answers
Can the animation editor create local rotational data? 3 Answers
Adding animation clips via script 2 Answers