Script Language: C #
1. deltatime:
Deltatime indicates the time from the last call of update or fixedupdate. Calling deltatime can make the rotation of an object run at a constant speed, it is not affected by frame rate control or computer performance.
2. Use of the time variable:
Indicates the time that has elapsed since the beginning of the game.
3. instance:
Create a script timeshow and add it to the main camera object of the main camera. The script code is as follows:
Using unityengine; using system. collections; public class timeshow: monobehaviour {// use this for initialization void start () {}// update is called once per frame void Update () {} void ongui () {guilayout. label ("current time is:" + time. time); guilayout. label ("the time consumed by the previous frame is:" + time. deltatime); guilayout. label ("fixed increment time:" + time. fixedtime); guilayout. label ("fixed increment interval:" + time. fixeddeltatime); guilayout. label ("smooth deltatime:" + time. smoothdeltatime );}}
The variable values in the time class are displayed in the game window as follows: