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.
18.225.149.238