I use a simple script for displaying the tenths of seconds on a timer.
The following script is called GUITimerFragment.js and is applied to an empty game object I call GUI.
var startTime;
function Awake () {
startTime = Time.time;
}
function OnGUI () {
var runningTime = ((Time.time-startTime)*10)%10;
runningTime = String.Format ("{0:0}", runningTime);
GUI.Label(Rect(83,323,200,200), runningTime.ToString());
}
The issue is this: the timer begins counting the tenths of seconds normally:
1...2...3...4...5...6...7...8...9...10
only that I want it to display 0 instead of 10. I thought that the line
String.Format ("{0:0}", runningTime)
would make it show only one digit but it seems I'm wrong.