Creating a message that fades away
Sometimes, we want a message to display just for a certain time, and then fade away and disappear, which will appear as shown in this screenshot:
Getting ready
This recipe adapts the first recipe in this chapter, so make a copy of that project to work on for this recipe.
For this recipe, we have prepared the script that you need in a folder named Scripts
in the 1362_01_04
folder.
How to do it...
To display a text message that fades away, follow these steps:
- Import the provided C# script class called
CountdownTimer
. - Ensure that GameObject Text-hello is selected in the Hierarchy tab. Then, attach an instance of the
CountdownTimer ...
Get Unity 5.x Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.