Input.GetAxis("Mouse X") only returns zero
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
Answer by SlimBun · Sep 27, 2020 at 06:49 PM
Check if your input settings are fine, Go to edit -> Project Settings -> Input Manager
I've faced the same problem and my settings are fine it just return zero for delta x and delta y
Your answer
Follow this Question
Related Questions
DeadZone in the corner of a xBox controller 0 Answers
Jump Input Problem 0 Answers
I have an issue with the code for Submenu. Someone to help me ? 1 Answer
Working on dual controls using character controller 0 Answers
Contollers are unusable when already plugged in when starting build/editor 0 Answers