- Home /
Timer tutorial help.
In this tutorial to make a timer count down, under "function Update" we subtract the value of "Time.deltaTime" from a variable.
Here is my question, lets say that the "function Update" only refreshes every 1/10 of a second, and the variable (we will call it mytimer) is set to 5.0. At 0 seconds (from the start of the game) "function Update" refreshes and subtracts 0 from "mytimer", "myTimer" still has a value of 5.0. At 0.1 seconds (from the start of the game) "function Update" refreshes and subtracts 0.1 from "mytimer", "myTimer" now has a value of 4.9. At 0.2 seconds "function Update" refreshes again and subtracts 0.2 from "mytimer", "myTimer" now has a value of 4.7, right?... Because 0.2 seconds have past from the start of the game. But this is not what happens, Unity subtracts 0.1 (so to speak) from "myTimer" every time function Update refreshes?
Answer by Eric5h5 · Sep 24, 2010 at 08:50 PM
Time.deltaTime is the time since the previous frame (hence "delta"), not since the start of the game. Time.time is from the start.
Answer by skovacs1 · Sep 24, 2010 at 08:50 PM
Wrong.
Time.deltaTime
is the time since the last frame. If your framerate is a constant 10 (which is terri-bad), then every Update() Time.deltaTime would be 0.1.
Time.time
is the time since the start of the game.
So that's why it felt like someone, somewhere was typing at the same time as me....
Your answer
Follow this Question
Related Questions
Countdown timer in minutes:seconds:milliseconds 2 Answers
How do I make my timer start and stop when on certain levels? 1 Answer
Can anyone help me figure this script out? (Light Trigger) 1 Answer
Timer not work :( 0 Answers
Speed Affect Timer 1 Answer