I am trying to implement a racing timer in the format : 00:00:00, (minutes,seconds,fractions).
Using the search in the forum I have found this lines, (the code is not complete but this are the conflicted lines):
var currentTime = Time.time - startTimer;
var roundedTimer = Mathf.FloorToInt(currentTime);
displaySeconds = roundedTimer % 60;
displayMinutes = roundedTimer / 60;
displayFractions = (roundedTimer*100) % 100;
And the format for the GUI is:
Current = String.Format (“{0:00}:{1:00}:{2:00}”, displayMinutes, displaySeconds,displayFractions);
The case is if I use : “MathFloorToInt” I don´t get fractions (only minutes and seconds) and if I don’t use that function the problem is although I get fractions ok but whenever the seconds reaches 30 the minutes go up… ??
I know I have to use a function like “MathFloorToInt” or similar but I want the fractions to be displayed also, so
any idea to solve this?
Thanks