Game Development Reference
In-Depth Information
Like Unity, MonoDevelop also has some keyboard shortcuts that you can find at MonoDevelop ➤
Unity Preferences ➤ KeyBindings (Figure
2-13
).
Figure 2-14.
MonoDevelop
➤
Unity Preferences
➤
Key Bindings menu of keyboard shortcuts
When you create a new script, Unity automatically includes a few items.
#pragma strict
will be at
the beginning of all of your scripts. It tells the compiler that variables must have type declarations,
which you will learn more about later in this chapter. It also creates the empty
Start()
and
Update()
functions. For now, go ahead and delete the
Update()
function, including the open and close braces:
function Update () {
}
Since this new script is attached to the game object, the
Start()
function will be called once when
the game object enters a scene. In the sample project here, the game object is already present in the
scene, so its
Start()
function is called as soon as game play is started. Type your first line of code
between the braces of the
Start()
function to see this in action.
function Start () {
print("Hello World!");
}