Use of Unity Basic time

Source: Internet
Author: User

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:

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.