private var currentTime = 0;
function Update (){
if (Input.GetAxis("Fire3")){
currentTime = currentTime + Time.deltaTime;
}
Debug.Log(currentTime);
}
private var currentTime = 0;
function Update (){
if (Input.GetAxis("Fire3")){
currentTime = currentTime + Time.deltaTime;
}
Debug.Log(currentTime);
}
You have to press third mouse button then only it increment currentTime value.
First you have to place
currentTime = currentTime + Time.deltaTime;
out side any of the if statement and check whether it increment or not.
Also one more update, change your currentTime variable type to float not var.
If you want to check only when the button is pressed to add to counter when the button goes down then use:
if (Input.GetButtonDown("Fire3"))
If you want to check if that button is pressed for each frame then use:
if (Input.GetButton("Fire3")