- Home /
[CLOSED] how can i get unity back to the normal timescale after running the game with it set to 0?
i ran into the this problem once before, and they only way i could fix it was scrap the project and re-install unity. which was the only way i got it to work, but i lost 5 months worth of work. and now i am facing the same problem again with a pause menu that did the same thing.
when i wanted to set the pause setting to 0 it worked, but when i tried to unPause it, nothing happened i went into other areas of my game and found that they were paused.
i did try setting the timescale back to 1 but it only worked half way and my character's movements were very choppy and did not preform as intended to.
the script i used was this:
// Toggles the time scale between 1 and 0.7
// whenever the user hits the Fire1 button.
function Update () {
if (Input.GetButtonDown ("Fire1")) {
if (Time.timeScale == 1.0)
Time.timeScale = 1.0;
else
Time.timeScale = 1.0;
// Adjust fixed delta time according to timescale
// The fixed delta time will now be 0.02 frames per real-time second
Time.fixedDeltaTime = 1.0
}
}
found on the unity Wiki.
and i also get these errors, which i do not know where they come from or the source they are.
if anyone has every faced this problem and found a way to fix it or at least something to resolve it, i would greatly appreciate it.
thank you -
Ownerfate
How about this line?
EditorApplication.isPaused = false;
http://docs.unity3d.com/Documentation/ScriptReference/EditorApplication-isPaused.html
sorry, nothing is happening, still doing the same stuff.
If you click on one of the errors does it give you more info at the bottom of the console window?
i lost 5 months worth of work.
Ever hear of this newfangled invention called "a backup"?
Answer by haim96 · Dec 09, 2013 at 03:06 PM
wait, wait... i want to understand... you set timescale=0 somewhere in your code and it messed your editor? you scraped the project and re install because of this?! how is that happen?! why you can't edit your code and remove the timescale line? is this editor script?
yeah, i know it's strange but it effected unity in a way i could not work in any other projects, and even if i did remove it, is set the state to 0 and did not work.
and @meat500: i took a look deeper and found the problem, i had to remove the whole level and rebuild it.
I believe pausing your game, your application and your editor could be three different things.
Editor pause is like clicking the editor pause button, Application pause is like when you change between active apps in Android/iOS and your app is temporarily suspended.
To pause the realtime gameplay, playing with timeScale alone should handle things nicely so using actual .pause-like calls will end up having other effects you didn't anticipate, as it seems may be the case.
If you've used OnApplicationPause() to disable all gameObjects or something like this, you may find you need to reenable those objects and also manually call their Start() routines, as I've found to be the case.
i think you may have something there, let me test it and see what happens.
ok, 2 things, with time scale, i set it back to 1 which was the default time of unity, i think the game will run, but characters are very choppy in movement, and frame rate was destroyed.
Example: 200 FPS turned into 2 FPS. then stayed up to a constant 15 - 20 FPS.
i will try the ' OnApplicationPause ' function.
tested - somehow it worked, i really don't know why, because i didn't use that function on any script i'v written so far.
but thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220613123757im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Substute for Array.length? 2 Answers
Unity player error 1 Answer
Why am I getting this BCE0019 error? ScreenToWorldPoint' is not a member of 'System.Type 1 Answer
How do I fix this error? I have more errors but this is the main one 1 Answer
error CS0246: The type or namespace name `MultipartStreamProvider' 0 Answers