Hi there i´m new to unity and like to solve a problem: i like to run the timer/countdown backwards from 15-0 and after this going to an game over screen
using UnityEngine; using System.Collections; using UnityEngine.UI;
public class Timer : MonoBehaviour {
public Text counterText;
public float seconds, minutes;
// Use this for initialization
void Start () {
counterText = GetComponent <Text> () as Text;
}
// Update is called once per frame
void Update () {
minutes = (int)(Time.time / 60f);
seconds = (int)(Time.time % 60f);
counterText.text = minutes.ToString ("00") + ":" + seconds.ToString ("0000");
}
}
Comment
Your answer
Follow this Question
Related Questions
Need thinking event, during time it takes to smtpserver.send 0 Answers
Start and Stop Timer Help 1 Answer
Player Countdown Interaction/Time Reduction+Addition 0 Answers
20 minute countdown timer 2 Answers