Question by
MiguelACZ · Jan 24, 2018 at 06:40 AM ·
timertime.deltatimetimer-script
How to slow down my timer script?
I need a timer for my game which will count down the "days" you have left to complete the game. I got he timer working but i would like it to move slower, for example i would like the timer to decrease by 1 every two minutes or so. Can anyone help me out with this i'm fairly new to Unity and it's for a school competition. Here is my script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Timer : MonoBehaviour {
Text text;
public float timeLeft = 40f;
// Use this for initialization
void Start () {
text = GetComponent<Text> ();
}
// Update is called once per frame
void Update () {
timeLeft -= Time.deltaTime;
if (timeLeft < 0)
timeLeft = 0;
text.text = "Days Left: " + Mathf.Round (timeLeft);
}
}
Comment