Objective: Increase “Player Speed when the “Left Shift” key is held down.

To make this magic is the use of the “Input.GetKey” function call. If we use the “Input.GetKeyDown” we only get a TRUE condition for a very brief moment after the key is pressed. “Input.GetKey” stays TRUE as long as we hold the key down.

While holding down the “Left Shift” key we change the value of “_speed” from 4 to 8.

--

--

Objective: Provide functionality to quit a Unity application using the “Escape” (Esc) key.

This is a simple task to complete thanks to the “Application.Quit( )” function. Place the above code in a “void Update( )” function body as shown below and you are finished.

--

--