大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。
timeScale;
Description
The scale at which the time is passing. This can be used for slow motion effects.
When timeScale
is 1.0 the time is passing as fast as realtime.When timeScale
is 0.5 the time is passing 2x slower than realtime.
When timeScale
is set to zero the game is basically paused if all your functions areframe rate independent.
Except for realtimeSinceStartup, timeScale
affects all the time and delta time measuring variables of the Time class.
If you lower timeScale
it is recommended to also lower Time.fixedDeltaTime by the same amount.
FixedUpdate functions will not be called when timeScale
is set to zero.
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Update() { if (Input.GetButtonDown("Fire1")) { if (Time.timeScale == 1.0F) Time.timeScale = 0.7F; else Time.timeScale = 1.0F; Time.fixedDeltaTime = 0.02F * Time.timeScale; } } }
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/117409.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...