Input.GetButtonDown Manual     Reference     Scripting  
Scripting > Runtime Classes > Input

static function GetButtonDown (buttonName : string) : bool


Returns true during the frame the user pressed down the virtual button identified by buttonName.

It will not return true until the user has released the key and pressed it again.

// Instantiates a projectile whenever the user hits the Fire1 Button.
var projectile : GameObject;
function Update () {
if (Input.GetButtonDown ("Fire1")) {
clone = Instantiate (projectile, transform.position, transform.rotation);

Use this only when implementing action like events eg. shooting a weapon. Use Input.GetAxis for any kind of movement behaviour.