Input.GetButtonUpstatic function GetButtonUp (buttonName : string) : boolDescriptionReturns true the first frame the user releases the virtual button identified by buttonName. It will not return true until the user has pressed the button and released it again. // Instantiates a projectile whenever the user hits the Fire1 Button. var projectile : GameObject; function Update () { if (Input.GetButtonUp ("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. |
