i need to find a simple way to write 0:00:00 into a gui text format with each 0 behind : being a different varible. so basically hours minutes and seconds.
i can do all this and tell it every 60 seconds add one to minutes and so on, but the one thing i cant seem to do is write 0:00:00. i can write it as numbers beside one another but i need the : between them which i just cant do
D tells it that it’s a digit and 2 the number how often.
So guiText.text = string.Format("{0:D5}", 5); will output 00005 (since 5 is 1-digit, the remaining will be filled with zeros)
so whats a different way of getting the real time without using Time.time as i need the time to start and stop at diferent places. at the moment im using yield wait for seconds and then add one.. then if a number reaches a certain number add one to the next and set back to 0.
Didn't checked out answers for a while. Usually you'd remember the time when you start the timer. ie. public void StartTimer() { startAt = Time.time; } And then just calculate the difference: float difference = Time.time - startAt; That's the milliseconds that passed since you started. Now you just have to format it (divide through 1000 for seconds, divide that through 60 for minutes etc.)
so whats a different way of getting the real time without using Time.time as i need the time to start and stop at diferent places. at the moment im using yield wait for seconds and then add one.. then if a number reaches a certain number add one to the next and set back to 0.
– reptilebeatsDidn't checked out answers for a while. Usually you'd remember the time when you start the timer. ie. public void StartTimer() { startAt = Time.time; } And then just calculate the difference: float difference = Time.time - startAt; That's the milliseconds that passed since you started. Now you just have to format it (divide through 1000 for seconds, divide that through 60 for minutes etc.)
– Tseng