Hello,
Can some one please help me understand why Input.GetAxis(“Mouse X”); always returns 0 in my script:
void Update() {
if (Input.GetMouseButton (0)) {
Debug.Log (Input.GetAxis("Mouse X"));
}
}
If i place the debug log for GetAxis outside the if statement, it works as expected, but I would have expected the normal practice would be to place your GetAxis as close to where you need to use it as possible, so in the if statement, as i only need the value when the mouse is being dragged. Please help me understand why Input.GetAxis will only return 0 from within the if, but not from outside of it.
any help appreciated.
Thanks