Time.time: The time this frame has started (Read Only). This is the time in seconds since the start of the game.
Time.time是这一帧开始的时间,从游戏开始时计算。
Time.deltaTime:The time in seconds it took to complete the last frame (Read Only).
Time.deltaTime是完成上一帧的时间,也就是本帧开始的时间减去上一帧开始的时间。
以下是测试的代码
lasttime记录上一帧开始的时间。
Time.time-lasttime是本帧开始的时间减去上一帧开始的时间,可以看到Time.delatTime总是同Time.delatTime相同。
using UnityEngine;
using System.Collections;
public class timea : MonoBehaviour {
private float lasttime;
void Update ()
{
Debug.Log(Time.time);
Debug.Log(lasttime);
Debug.Log(Time.time-lasttime);
Debug.Log(Time.deltaTime);
lasttime=Time.time;
}
}