Input.GetKey Shift Key disbles GetAxis Mouse ScrollWheel?
Hi all, I cannot seem to get the scrollwheel to work with the Shift key down.
It works with any other keycode, such as LeftAlt, but not a Shift key. As soon as I press shift, the scroll wheel does not register at all.
What could be going on?
Here are two methods I've tried:
// method A ***********
if( Input.GetKey( KeyCode.LeftShift ) ) {
Debug.Log( "ShiftKey pressed" );
}
float scroll = Input.GetAxis( "Mouse ScrollWheel" );
if( scroll > 0.001f ) {
Debug.Log( "Scrolling = " + scroll );
// no output if shift down
}
//***********
// method B ***********
float scroll = Input.GetAxis( "Mouse ScrollWheel" );
if( scroll > 0.001f ) {
Debug.Log( "Scrolling = " + scroll );
if( Input.GetKey( KeyCode.LeftShift ) ) {
Debug.Log( "ShiftKey pressed" );
}
// no output if shift down from either Log
}
//***********
Thanks for your help!
Answer by tormentoarmagedoom · Mar 07, 2020 at 10:38 PM
EDITED
Hello again.
Then makes nos ens.. it shoud work. As you are just cheking for the scroll value, are you sure is not working? did you deguged the code to see if the code reaches that line?
Debug it and check whats the value of scroll at that moment.
Perhaps you did not understand?
neither method works. As soon as you press shift the Input.GetAxis scroll wheel appears to be completely disabled.
$$anonymous$$y method A is exactly as you suggest, and no, it does not work!
No, it doesn't make sense.
I've been debugging it for a couple of days now.
As soon as you hold down the shift key the value of the Inptu.GetAxis scroll wheel becomes 0.
Again, it's like the shift key disables the scroll wheel.
The question is what causes this to happen, because i can certainly shift scroll in the Unity Editor, and in other applications.