Time类中的静态变量

一直对Time.deltaTime很模糊,这次看文档,看视频稍微了解了一下
Unity官方文档:https://docs.unity3d.com/ScriptReference/Time.html
Siki老师的Time视频:http://www.sikiedu.com/course/59/task/1382/show

代码:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 //Time类静态变量的学习
 public class timeTest : MonoBehaviour {

// Use this for initialization
void Start () {
    
}

// Update is called once per frame
void Update () {
    //当前帧多占用的时间,每帧时间间隔
    //会在默认的帧间隔时间上下波动,即0.02上下波动
    //和游戏逻辑有关系,电脑设备硬件也有影响
    Debug.Log("Time.deltaTime" + Time.deltaTime);
    //每帧时间(固定的,默认为0.02,因为unity设置一秒为50帧)
    Debug.Log("Time.fixedDeltaTime" + Time.fixedDeltaTime);
    //游戏开始所占用的时间
    Debug.Log("Time.fixedTime" + Time.fixedTime);
    //游戏运行时间(尽管游戏暂停,但是这个时间还是会持续增长)
    Debug.Log("Time.realtimeSinceStartup" + Time.realtimeSinceStartup);
    //游戏运行时间
    Debug.Log("Time.time" + Time.time);
    //游戏运行开始一共运行了多少帧(帧数)
    Debug.Log("Time.frameCount" + Time.frameCount);
    //时间比例,可以使游戏暂停或加速播放,默认为1
    Debug.Log("Time.timeScale" + Time.timeScale);
    //相比于Time.deltaTime,这是平滑的时间间隔变化
    Debug.Log("Time.smoothDeltaTime" + Time.smoothDeltaTime);
    //游戏从开始到现在运行的时间,不受Time.timeScale的影响
    Debug.Log("Time.unscaledDeltaTime" + Time.unscaledDeltaTime);
    //从当前场景加载完成之后这个游戏运行的时间
    Debug.Log("Time.timeSinceLevelLoad" + Time.timeSinceLevelLoad);
}
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容