- Home /
 
 
               Question by 
               Alp-Giray-Savrum · Feb 06, 2014 at 11:36 AM · 
                animationpausestoptime.timescale  
              
 
              Stop Whole game except one one object
Hello Devs, I want to know is there a script that can i do that ?
I wanna make a pause button;
When i press pause button, set Game's Time.timeScale = 0;
When i do this whole game stops but i want to play animation of my pauseMenu object. So how can i do thet ?
               Comment
              
 
               
              Answer by kannan21 · Feb 06, 2014 at 11:41 AM
 Don't use timeScale use a custom bool for pausing. For eg.
 
 bool isPaused=false;
 void Update()
 {
 if(!isPaused)
 {
 ///your code here
 }
 }
 
 use that variable in all places to pause. Except for the things which u don't want to be paused.
 
              I also have an animated background for the pause menu UI and I hope that writing an extra condition for every animated object in the game isn't the only solution
Your answer