A leap of faith

The first piece of code (the first line of our Script) looks like this:

#pragma strict

What on Earth does that mean? We've been hit with confusing nerd talk right out of the gate. The simple explanation for this line is that it makes writing your code more fussy, but your code runs faster. We'll learn what that's all about later; for now, turn your attention further down to the Start function:

function Start () {
}

Click to place your cursor after the first curly brace, and press the Enter key to make some space between the top and bottom curly braces. Press the Tab key to indent, to make your code look pretty, if the editor doesn't automatically do it for you. Then, type a single line of code so that your Script looks like this:

function Start () {
 renderer.enabled = false;
}

You'll notice that as you type each word in this line of code, entire drop-down lists pop open with a dizzying list of strange-looking options. This is called Code Hinting, and while it may seem annoying when you first encounter it, you'll be erecting a shrine to it by the time you finish this book. Code Hinting brings a programming language's entire dictionary to your fingertips, saving you the hassle of looking things up or misspelling special keywords.

You may also notice that the word false lights up after you type it in. MonoDevelop highlights special reserved code words (keywords) to signify that they have special meaning to Unity.

A little asterisk ("star") appears next to your Script's name in the menu bar of MonoDevelop whenever you have unsaved changes, as shown in the following figure. Save your Script by pressing Ctrl + S or command + S on the keyboard, or by navigating to File | Save from the menu. For the remainder of this book, we'll assume that you've saved any modifications that you've made to your Scripts before trying them out.

A leap of faith

Tip

The Sound of One Hand Clapping

Careless coders often wind up banging their heads against their desks when they test their code and nothing new happens—usually because they've forgotten to save their code files! Even though you've typed a bunch of code, nothing new will happen when you run your program unless your files are saved, so don't forget!