Unity – Horizontal and Vertical – Get Axis

Horizontal and Vertical Control – Complete Example

#pragma strict

function Start () {

}

var speed : float = 10.0; // to change speed

function Update () {

 var horiz : float = Input.GetAxis("Horizontal");
 var vert : float = Input.GetAxis("Vertical");

 // Make it move 10 meters per second instead of 10 meters per frame...
 horiz *= Time.deltaTime;
 vert *= Time.deltaTime;
 
 transform.Translate(Vector3(horiz*speed,vert*speed,0));
}