game snake move

how can I make sure to tell my object when I press the right arrow he must go infinitely right? and when I click the left must do the opposite? I have tried using if (Input.GetAxis) but right when I remove your finger from the button stops this is the script:

#pragma strict


function Start () {






function Update () {








You could have a “last direction pressed” of sorts, and instead of using the vertical axis on the Input directly, use the Input to change the last pressed direction, and use the traslate at all time (outside the If input statement) using the last direction pressed.