- Home /
Time.timeScale=0 Problem Help please
I have a problem with Time.timeScale
function Update () {
Time.timeScale = 0;
}
If i use the upper code actually its speed up my player move twice
but if i use
function Update () {
if(Input.GetKey ("h")){
Time.timeScale = 0;
}
}
It pause the game. Whats the problem Thanks.
Sorry for bad English
Time.timeScale=0;
is a one-shot function. i.e., you call it once, and everything stops.
if you put it inside Update, it calls it again and again. But why does it speeds up, I don't know. But you don't do that, anyway. Your second code is correct, since it only fires once on keypress event of h. $$anonymous$$aybe you want to change it to Input.Get$$anonymous$$eyUp("h")
though.
Thanks for answer.
It seem that its Unity bug because if i set timeScale to zero in project settings>time. NOthing happend all functions updates and objects moves.....
But if i change time scale value later in agame all works good.
I need a timeScale value to be zero at start of the scene. How i can do it? And i need it to work)))
Answer by create3dgames · Jul 05, 2013 at 04:16 PM
Do this instead:
function Update ()
{
if(Input.GetKey ("h"))
{
Time.timeScale = 0;
}
else
{
Time.timeScale = 1;
}
}
Your answer
Follow this Question
Related Questions
How do I pause my game? 24 Answers
Level completed but still playable (timescale problem) 0 Answers
Can't set Time.timeScale back to 1. 2 Answers
Best practice for countdown timer on game resume 1 Answer
Creating a pause menu (problem using Time.timeScale) 3 Answers