private float tiempo;
void Update()
{
tiempo += Time.deltaTime;
if (tiempo >= 5f)
{
Debug.Log("Pasaron 5 segundos");
tiempo = 0f;
}
}
[SerializeField]
private float tiempoRestante = 10f;
void Update()
{
if (tiempoRestante > 0f)
{
tiempoRestante -= Time.deltaTime;
}
else
{
tiempoRestante = 0f;
Debug.Log("Tiempo terminado");
}
}
Para UI o pausa:
tiempo += Time.unscaledDeltaTime;
Time.deltaTime
Time.unscaledDeltaTime