- Home /
Time.timescale has no effect
I am setting the Time.timescale in my game at the beginning of my game and it seems to have no effect. I have a Debug.Log that is printing the timescale has 0 so it gets set but nothing seems to be paused. If i set it later in the game using key input it seems fine but not in the update, OnGUI , or start function or even a custom one. The time manager in the inspector also shows the change but physics is still running and everything seems unpaused. All I want to do is start the game paused and start it when a player presses start. Is setting timescale to 0 on beginning of game bugged?
Ugh this is frustrating upon further testing even if I use a invoke of 30 seconds then set it to 0 it shows the change in Inspector but makes no real effect. Then right after if I use my escape menu button trigger it pauses the game instantly. This is making no sense whatsoever.
How about showing us every piece of code you're using to affect Time.timeScale and enough context so we might spot a problem.
Answer by Elit3d · Nov 09, 2014 at 12:49 AM
Time.timeScale = 0 should work. Can you show us a bit of the code so we can look more into the problem?
+1. This should be right. So something else must be interferring.
The thing is it is working , it sets the timescsle to 0 in the inspector project setting time panel but doesn't cause anything to pause. I've tried disabling every single script except the character controller and obviously this one in my game and simplifying it down to void Start () { Time.timescale = 0; } but I can still move around with my character etc even though the time panel in the inspector shows the timescale as 0.
if this helps, this is how I wrote $$anonymous$$e for my pause menu. if (Input.Get$$anonymous$$eyDown("escape")) { pauseGame = !pauseGame; if(pauseGame == true) { Screen.showCursor = true; Time.timeScale = 0; pauseGame = true;
@237641: If you can still move around when Time.timeScale is set to 0 you probably don't use Time.deltaTime in your movement code. Without more information we can't say anything specific.
Your answer
Follow this Question
Related Questions
Is It Bad To Have Your Jump In Update()? 3 Answers
time.unscaled time help please? 1 Answer
Trying to make touch/holding screen not toggle menu. 0 Answers
Ideas for Animating while Paused? 9 Answers