|
Can you explain how to use Time.time, how it work?
(comments are locked)
|
|
Time.time simply gives you a numeric value which is equal to the number of seconds which have elapsed since the project started playing. The value is a 'float', which means that you get exact time including the fraction of the second which is currently elapsing, rather than discrete whole-number seconds. Time.time is useful for many purposes, and it's often used when comparing the current time against a time stored in a variable, to check how much time has elapsed since a certain moment, or how much time remains until a certain future moment. A common mistake is to use Time.time as the 3rd parameter for a 'Lerp' function. When using Lerp, you would usually need to use Time.deltaTime instead. Time.time never changes during the course of a function, so you cannot use it to profile code that takes place inside a single function. Time.time (and Time.deltaTime) only change their value once per frame. For more information, see the Time.time manual page, and the Time Class manual page which - if you click on each function or property of the class - has examples of how to use each of these things. When you say Time.time and delta time does not change during a function call, does that include realTimeSinceStartup too? You have given this answer in some other threads too but you never say anything about Time.realTimeSinceStartup.
Jan 05 '10 at 10:18 PM
TowerOfBricks
The main difference betweeen Time.time and Time.realTimeSinceStartup is that the latter is not effected by Time.timeScale. In other words: If you have Time.timeScale = 0.1F, when Time.realTimeSinceStartup = 10F, Time.time would be 1F (10 seconds in "real time" would be equivalent to 1 second of "game time").
Jan 06 '10 at 07:30 AM
jashan
Time.realTimeSinceStartup DOES change during a function call.
Jan 06 '10 at 04:33 PM
runevision ♦♦
(comments are locked)
|

cross-reference http://answers.unity3d.com/questions/14288/can-someone-explain-how-using-timedeltatime-as-t-i.html Greetz, Ky.