Button UI Animation while paused?

Hi,

When we use Time.Timescale = 0 to pause the game, the GUI works fine, but the button animation doesn’t play. Tint change works fine. (Unity 4.6 new GUI). How can we get around this?

Thanks & Regards
Rajesh

If you are talking about an animation done with Unity’s animation system (using an Animator component) you can change the “Update Mode” of the Animator component to “Unscaled Time”. This allows your animation to play independent of the time scale.

Anything that is based on Unity’s Time class won’t work when Time.timeScale is set to 0. That applies to all code written by you and code in the engine. So the most solid approach would be to pause your game in a more controlled manner in terms of dependency. It could be as simple as encapsulating all your MonoBehaviour scripts with an if statement that’s checking if the game is paused or not before updating.

void Update()
{
if(paused)
{
//run this Update().
}
}

alternatively toggle all MonoBehaviour.enabled when pausing and unpausing the game.