Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Time.timeScale

Cambiar al Manual
public static float timeScale;

Descripción

Escala a la que pasa el tiempo. Se puede usar para efectos de cámara lenta.

Cuando timeScale es 1.0 el tiempo pasa igual de rápido que en la vida real. Cuando timeScale es 0.5 el tiempo pasa el doble de despacio que en la vida real.

Cuando timeScale se establece a cero básicamente se pausa el juego si todas tus funciones son independientes del frame rate.

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; } } }