Stopwatch will not show time.
Hi! I am a bit new to unity and I have a stopwatch added to my game based on @freezing_ example. The Issue I'm having is when the game is finished and I have it show the time, The "Your Time" bit will show but the actual time will not. Here is where I'm having the issue.
void SetCountText ()
{
countText.text = "Count: " + count.ToString ();
if (count >= 12)
{
winText.text = "You Win!";
timer.Stop ();
finishTime.text = "Your Time: " + timer.ToString ();
}
}
Thanks for your help! ,
Answer by Jessespike · Sep 27, 2016 at 05:59 PM
Try the Elapsed property or equivalent.
finishTime.text = "Your Time: " + timer.Elapsed.ToString ();
https://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.elapsed(v=vs.110).aspx
Ok Thanks! I will try this and let you know if it works.
Your answer
Follow this Question
Related Questions
Remove unnecessary text from a string 1 Answer
How to start a timer after an update 0 Answers
Using variable names as seen in the inspector 1 Answer
Text doesn't change with string C# 1 Answer
how to connect my Health to my UI 1 Answer