- Home /
Time.timescale set to 0 whenever i start
I've got this odd issue, whenever i start my game, the timescale is set to 0, effectively pausing the game.
I have no idea why my game does this, i've read and reread all my scripts to find out where i've done this, but i cannot find it.
So, is it possible for me to have pressed some button that makes unity pause the game whenever i start my game?
Cheers
Kacer
There's a pause button next to the play button in the editor, check that isn't depressed :P.
How do you know Time.timescale = 0?
because if i write "time.timescale = 1" in "Awake" the game runs smoothly :)
the pausebutton is unchecked.
a better way to check would be:
function Update()
{
print("time is :"+timeScale)
}
This will check if Update is being called, and if it is you will see a frame-by-frame update of the current timeScale.
Let me know what results you get.
Also, i know you have said you have checked, but it is most likely you are pausing the game somewhere, have you got a pause menu script or anything similar somewhere? An error in that could be causing this.
Does this happen if you create a new, empty project?
it prints the timescale as "0", which just confirmed my suspicions.
It does not happen in any other projects i have, and i do not pause the game anywhere, i'll gladly share my scripts if you doubt me :P
There is only one place in my scripts where timescale gets set to 0, and that is commented out, for debugging. I've tried deleting that line as well, but it doesnt change anything.
I am deeply mystified by this.
here's the print info:
time is :0 UnityEngine.Debug:Log(Object) Character$$anonymous$$ovement:Update() (at /Assets/Scripts/CharacterScripts/Character$$anonymous$$ovement.cs:36)
another thing you can do is:
Create a new script, call it timetest.
in this script add the following:
function Awake()
{
print("time is:"+timeScale);
}
function Start()
{
print("time is:"+timeScale);
}
Then change your execution order so that timetest is the first in the list. This way, if you see timeScale as 1. We know one of your scripts is changing it.
Answer by timsk · Sep 29, 2011 at 01:52 PM
Well, after a lengthy discussion we discovered you can set the Time.timescale permanently for the project using:
Edit -> Project Settings -> Time.
The hotkey pixie may have paid a visit. Let us know if you found a hotkey btw, be handy to know :).
Got the same issue. Commented out all time.timescale. If I hadn't seen this answer, the next step was to start pulling out my hair one strand at a time. Thanks!
I managed to cause this effect not via a hotkey but by quitting Unity when a scene was running which had set Time.timeScale to 0.
Hello from the future! hotkey pixie is still alive and as annoying as ever. Thank you so much!
It happened to me after upgrading an old Unity 5 project to Unity 2018 (although I had an intermediate step on Unity 2017). It caused all animators to stop and logged error: "Invalid time range for Transition exit time condition".
In the Project Settings > Time, I had: - Fixed Timestep: 0.0001 - $$anonymous$$aximum Allowed Timestep: 0.0001 - Time Scale: -8.68805e-44 (!) - $$anonymous$$aximum Particle Timestep: 0.03
Answer by henry96 · Sep 29, 2011 at 01:20 PM
There may be some setting somewhere in your script. It can be on the update function or OnGUI (). So reread all the code again to find the issue. Also, you can set the timescale = 1 at the beginning.
i.e
function Awake ()
{
Time.timeScale = 1;
}
Again, try to reread your code to find error.
This is my current fix to the problem, nothing new there.
I've only got 5 active scripts in my project at the moment, and i've been working with those scripts all day, believe me when i say that i do not set timescale to 0 anywhere :)
thanks for your time though.
I see!!! Well, I suggest you go to Edit -> Project Settings -> Time . And check timeScale. This may not solve your problem. But it's another way to check it! :)
Answer by Hotsaucehater · Oct 02, 2014 at 01:40 AM
Make sure you don't have the "Error Pause" option selected in the console.
Answer by Binxalot · Sep 01, 2013 at 08:08 PM
Thank god for this post, I had the same thing just happen to me, spent 20 minutes browsing all of the recent changes I made to my code, gave up in frustration and then decided to check answers to see if it was an issue others have had. Never once did I open up the Project > Time window to change that value to 0, not sure why or how it happened but thanks for this post.
Your answer
Follow this Question
Related Questions
2nd independent deltaTime and timeScale variables, or a way to mimic this? 1 Answer
Is it possible to change Time.timeScale to a value bigger than 100? 0 Answers
What's stopping 'WaitForSeconds' from working? 1 Answer
Unable to change Time.timeScale 2 Answers
I Need Help converting somthing to C# 3 Answers