Still time for action – changing the clock text color

Double-click on ClockScript. Your empty script, with the default the Start() and Update() functions and the #pragma strict line, should appear in the code editor. The very first thing we should consider is doing away with our puce background by changing the GUIText color to black instead of white. Let's get at it:

  1. Replace the Start function with the built-in Awake function and change the GUIText color:
    function Awake()
    {
       guiText.color = Color.black;
    }
    function Update() {
    }
  2. Save the script and test your game to see your new black text.

As we've seen before, Awake is a built-in function just like Start, but it happens even earlier. Awake is the first function that gets called when our script runs. ...

Get Unity 4.x Game Development by Example Beginner's Guide 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.