Input.GetButtonDown is fired during the frame when user pressed the button. The function return true only one time when user pressed it.
From the Unity Script Reference:
Input.GetButtonDown()
Returns true during the frame the user pressed down the virtual button identified by
You need to call this function from the Update function, since the state gets reset each frame. It will not return true until the user has released the key and pressed it again.
You can do something like this:
var rightButtonDown= false;
var leftButtonDown= false;
function Update(){
if(rightButtonDown){
//rotate...
}
if(leftButtonDown){
//rotate...
}
if(Input.GetButtonDown("tleft")){
leftButtonDown= true;
}
else if (Input.GetButtonUp("tleft")){
leftButtonDown= false;
}
if(Input.GetButtonDown("tright")){
rightButtonDown= true;
}
else if (Input.GetButtonUp("tright")){
rightButtonDown= false;
}
}
EDIT
I've made a huge mistake in my previous explanation.
GetButtonDown() is fired only during one frame when the button is pressed as well for GetButtonUp() when the button is released. So to know if the button is hold or not, you have to check state changes when GetButtonDown() or GetButtonUp() are true.
For example, you have a variable "buttonDown" wich is a bool(true, the button is down / false, the button is up). When GetButtonDown() return true, you can assume that the button is hold by user. So you assign true to "buttonDown" and you only change the value of "buttonDown" when GetButtonUp() return true.