Developing a well-formatted countdown that changes
In this recipe, we are going to create a countdown that displays the time on the screen as minutes and seconds. However, to take this display a step further, as the time elapses, it will change color. Just as the radial timer graphically represents the time that passes, a colored numeric timer provides a similar function. For example, in moments during gameplay when there is intense action, a player may not necessarily have the time to focus on the timer, or he may actually lose track of the time that has elapsed. Whatever the case may be, another good way to indicate to the player the time as it is decreasing is through color. Therefore, as the player is engaged in gameplay, the color of the time can provide a quick indication of how close he is to running out of time. We will use the Text (Script) component and develop a script to achieve our goal.
How to do it...
First of all, we need to create a new UI text to display our timer. To do...