Anthony M – Making the Timer

2017-12-01_10h20_21

To create the timer I just followed 2 guides and took the pieces that I needed, I knew it was to do with time.deltatime but i wasn’t too sure how to write it.

The timeLeft float is the main piece of code that will affect the start time, the rest of is is what will make it go down.

I can easily change anything i need, the parts in the comments was a piece of code i thought might work but didn’t, its something that can be explored later

2017-12-01_09h44_31

Since a majority of the code is private, this is what it looks like when its all public, the text part allows you to apply this code to a different object but you would have to dedicate the text component of the UI to it.

2017-12-01_09h44_42

The text box can be changed anytime, location wise and size wise, i just made the placeholder large enough for the numbers to be visible along the top centre of the screen.

2017-12-01_09h44_48

As seen here the timer is counting down from the 5 minutes that i imputed as the start time.

links:

https://answers.unity.com/questions/980339/count-down-timer-c-1.html

Leave a comment