September 2013
Beginner
292 pages
6h 19m
English
Decisions always have to be made when the user provides input. In Chapter 2, Introducing the Building Blocks for Unity Scripts, we used an example where the user had to press the Return/Enter key to call the AddTwoNumbers() method:
if(Input.GetKeyUp(Keycode.Return)) AddTwoNumbers();
The if statement condition becomes true only when the Return key is released after being pressed down. Here's a partial screenshot of the GetKeyUp() method as shown in the Scripting Reference:

After the Return key is released, AddTwoNumbers() is executed.
Notice that the code, AddTwoNumbers(), isn't between two curly braces. When ...