- Home /
Question by
davidflynn2 · Nov 22, 2012 at 09:18 PM ·
c#timerstop
Stop from showing point value
I have the following script showing my time reamaing. On the gui its showing with points in it how do i stop this. Example it shows like this 40.234 I want it to only show 40 how would i got about this.
This is the code.
public float timer = 60;
void Update ()
{
timer -= Time.deltaTime;
}
void OnGUI()
{
GUI.Label(new Rect (10, 30, 1000, 20), "Time Remaining: " + timer);
}
Comment
Best Answer
Answer by Jessespike · Nov 22, 2012 at 11:30 PM
GUI.Label(new Rect (10, 30, 1000, 20), "Time Remaining: " + timer.ToString("0"));
If you want to specify a format with decimal places, enter: "0.00"
http://msdn.microsoft.com/en-us/library/system.string.format.aspx
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Need help with my "simple" crafting system 1 Answer
Distribute terrain in zones 3 Answers
Creating a timer for combat (C#) 1 Answer