Hi Ive encountered a bug with using two shift keys simultaneously. Im on Windows 7 and the bug happens in the editor and the web player.
The bug happens with any Input methods of Unity “GetKey” , “GetKeyUp” and “GetKeyDown”. I tried them all.
Here are two code snippets , try each one separately you will see the bug is consistent.
What happens is when pressing two shift keys one after another (left then right or right then left) , if you release the second shift key you pressed before releasing the first shift key you pressed - it does not register with unity.
The bug only happens in that order … meaning if after pressing two shift keys , releasing the first key you pressed first will work fine as well as then releasing the second shift key , so please test it as mentioned above.
This is not a keyboard hardware problem (non n-key rollover etc) as I have some pinball engines on my computer that use dual shift keys without any problem.
- GetKeyUp/GetKeyDown
if(Input.GetKeyDown(KeyCode.LeftShift)){
Debug.Log("GetKeyDown left shift");
};
if(Input.GetKeyUp(KeyCode.LeftShift)){
Debug.Log("GetKeyUp left shift");
};
if(Input.GetKeyDown(KeyCode.RightShift)){
Debug.Log("GetKeyDown right shift");
};
if(Input.GetKeyUp(KeyCode.RightShift)){
Debug.Log("GetKeyUp right shift");
};
- GetKey
if(Input.GetKey(KeyCode.LeftShift)){
Debug.Log("GetKey left shift");
};
if(Input.GetKey(KeyCode.RightShift)){
Debug.Log("GetKey right shift");
};
Could someone else please test this? I did google it to see if anything popped up about newer versions of Unity having perhaps fixed this but didnt not see any results so im not sure.