Unity5.x Time用法详解

本文详细介绍了Unity游戏引擎中时间管理的各种参数,包括deltaTime、fixedDeltaTime等,并解释了timeScale的作用及其对不同更新方法的影响。
captureFramerateSlows game playback time to allow screenshots to be saved between frames.
deltaTimeThe time in seconds it took to complete the last frame (Read Only).
上一帧完成所用的时间秒(只读)
fixedDeltaTimeThe interval in seconds at which physics and other fixed frame rate updates (like MonoBehaviour's FixedUpdate) are performed.
在物理和固定帧更新的时间间隔秒(类似MonoBehavior's FixedUpdate)
fixedTimeThe time the latest FixedUpdate has started (Read Only). This is the time in seconds since the start of the game.
最近的一次FixedUpdate已开始的时间(只读)自游戏开始计时,以秒记。
frameCountThe total number of frames that have passed (Read Only).
已经执行的帧率的总数。
maximumDeltaTimeThe maximum time a frame can take. Physics and other fixed frame rate updates (like MonoBehaviour's FixedUpdate).
在物理帧和其他帧更新中,一帧能获取的最大时间。
realtimeSinceStartupThe real time in seconds since the game started (Read Only).
从游戏开始到现在所消耗的实时时间(只读)。
smoothDeltaTimeA smoothed out Time.deltaTime (Read Only).
一个平滑淡出的Time.deltaTime(只读)
timeThe time at the beginning of this frame (Read Only). This is the time in seconds since the start of the game.
从游戏开始到现在所消耗的时间(只读)。
timeScaleThe scale at which the time is passing. This can be used for slow motion effects.
时间的消耗速率,可以减慢运动效果。
timeSinceLevelLoadThe time this frame has started (Read Only). This is the time in seconds since the last level has been loaded.
从上次加载管卡完成到现在所用的时间(只读)
unscaledDeltaTimeThe timeScale-independent time in seconds it took to complete the last frame (Read Only).
不受timeScale系数影响的deltaTime。
unscaledTimeThe timeScale-independant time at the beginning of this frame (Read Only). This is the time in seconds since the start of the game.
不受timeScale系数影响的Time.time。
补充:
1.timeScale影响的是Time.deltaTime的值,但不影响Time.FixedDeltaTime.
2.timeScale影响FixedUpdate 的执行速率,但不影响Update和LateUpdate.

3.timeScale影响Time.time的值和Time.FixedTime的值。


所以 Time.timeScale=0 FixedUpdate的方法会停止执行,Update和LateUpdate会继续执行。

Time.timeScale=1 FixedUpdate的方法会继续执行。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值