Unity 3D - Countdown Timer

In order for the player to have more of a sense of fear and urgency, I decided to implement a countdown timer. Following questions and answers on Unity's answer forums (https://answers.unity.com/index.html), I managed to get it working well. I have the current time set at 15 minutes but this may change based on user feedback from testing.

I have two parts to the timer.

The first part is the text showing how much time is remaining. The script for this is placed on an empty object controller and works with delta time and formatting in order to have the time displayed as "TIME REMAINING: (mins):(secs)". Here is the script:














The second part of the timer is the visual linear timer.

This is a red line that slowly loses it's height in relation to how much time is left. Although it is not needed, it adds something to the UI that makes it a little more interesting, and allows the user to have a quick idea of how much time they have left instead of having to focus and read. Here is the script:














And here is how they look as part of the UI:












Having them both at either side of the minimap creates a very tight effect and keeps the UI very minimal, making sure it isn't clustering the screen.

Comments