So I made a timer that counts down 10 seconds and has 3 decimal places. The time that is getting taken away is making it have more then 3 decimals and I tried using “Mathf” but it would only work some times. I’ll add my code and a video on whats the timer doing.
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
public class timer : MonoBehaviour {
private Text textBox;
public float timeTaken;
// Use this for initialization
void Start () {
textBox = GetComponent<Text>();
}
// Update is called once per frame
void Update () {
timeTaken -= Time.deltaTime;
timeTaken = Mathf.Round(timeTaken * 1000.0f) * 0.001f;
textBox.text = "" + timeTaken;
}
}