Time.timeScale not working?

I have set Time.timeScale to 0 in start funct.

I have red a bug some there that somehow Unity “force” "firt"s frrame to Time.timeScale = 1.

So for testing (and make sure) I just set Time.timeScale in a function like this:

Update(){
        if(Time.deltaTime >=0.001f)
        {
            Time.timeScale = 0;
            Debug.Log("Wha the???"); ;
        }
}

How many time should the Debug entry shows?

Well in my case is in every update, never stops!!!.
And no, I have no other place that use Time.timeScale, not even for reading.

By the way, Time.deltaTime, never moves from 0,02!.

Ideas?
(if this is a noob, question, please refer me to “obvious” post or doc :slight_smile:

It should show every frame, unless you’re getting more than 1000fps.

–Eric

Hello, Eric, thank for your answer.

So, Time.timeScale does not affect Time.delta at all?

It does. It’s a little weird if you set timeScale to 0, in which case it always prints .02 like you said (which I guess is some default value that prevents a divide by zero error somewhere, possibly).

–Eric

Eric, if you look over unity answers and forum you will find that pause game is made by “Time.timeScale =0”.

Even more, no one has state anything about that being wrong.

http://forum.unity3d.com/viewtopic.php?p=258210

http://forum.unity3d.com/viewtopic.php?p=293131

http://answers.unity3d.com/questions/21/how-do-i-pause-my-game

http://answers.unity3d.com/questions/5411/time-deltatime-not-set-to-0-if-time-timescale-set-to-0-too-early

Maybe I am understanding something wrong?

Yes. I’m not sure what your question/problem is.

–Eric

If your game has time frame independent actions, that is vel = (speed* Time.DeltaTime)

and Time.DeltaTime is not going 0 (as show in the first post) when you set Time.timeScale to 0, how do you pause it?

If my English is not quite understandable, I resume:
¿What is the effect that pause your game after setting Time.TimeScale to 0?

Thanks

It makes physics and animation stop advancing in time, so those things are paused regardless of Time.deltaTime’s value. Anything you’re directly translating using Time.deltaTime wouldn’t be paused, but my standard advice is to use a very small value (like .000001) for the timeScale rather than 0 anyway. That way, you can have things like GUI animation using Time.deltaTime still function normally (as long as you remember to multiply by Time.timeScale) while your game is paused.

–Eric