I’m trying to get my camera to move on the x axis by 2 units 1 time when the right arrow is pressed, I don’t want it to keep moving while you hold down the button, just move one time then stop and wait for the arrow to be pressed again to move 2 units more. Here is my code and when I press the arrow button it keeps moving for a while.
function Update () {
if (Input.GetKey (“right”)){
transform.Translate (2, 0, 0);
}
if(Input.GetKey(“left”)){
transform.Translate (-2, 0, 0);
}
}