0

My timer is rounded to one decimal. In my update function I check if the timer is 0.8, but when it is 0.8 it does not return anything. However the debug log tells me that it has past 0.8.

https://i.gyazo.com/48e883e9b6eda385fb1afe9727b22828.png

void Update() 
{
 Debug.Log ("Elapsed time: " + (Mathf.Round(timerScript.elapsedTime * 10f) / 10f));
 if (((Mathf.Round(timerScript.elapsedTime * 10f) / 10f) == 0.8f)) {
 {
     Debug.Log ("CHECK");
 }
}

Is the if statement too slow? How do I fix this?

Jip Harthoorn
  • 292
  • 1
  • 8
  • 25

0 Answers0