- Home /
On Mac "left shift" and "right shift" trigger both Keys
I have noticed on my current Mac builds that if I bind "left shift" or "right shift" Unity behaves as if I have hit both shift keys whenever either is hit. I'm using the smaller Mac keyboard.
Specifically, if I put in this code:
if (Input.GetKeyDown(KeyCode.LeftShift)) { Debug.Log("Left Shift"); }
if (Input.GetKeyDown(KeyCode.RightShift)) {
Debug.Log("Right Shift");
}
Unity console will return both "Left Shift" and "Right Shift" each time the key is pressed. This also happens if I specifically bind the "left shift" and "right shift" keys to an input in the Input Manager.
If I build this same project to PC, the shift keys are correctly differentiated.
Anyone have an idea of a workaround for this? I'm working on a pinball game and it's fairly universal that you use the two shift keys for the flippers.
EDIT: Well, I just got an e-mail back from Unity QA and they say this is working as designed since Mac doesn't send different commands for each key. I beg to differ since I've seen games that support both keys. However this might be a limitation based on how Unity polls for keys.
Interestingly, Unity does distinguish between the two shifts correctly outside of gameplay in the Input Configuration menu prior to the game's launch via the $$anonymous$$ac Builder. This is clearly an actual bug with the Unity Editor and $$anonymous$$ac Player - I wrote back to the QA $$anonymous$$m.
Unity QA got back to me, I sent a sample project; assurances this will be addressed.
Unity QA let me know this is an anticipated fix for 3.5. A bit late for my game, but hopefully it will come soon.
Answer by Graham-Dunnett · Sep 26, 2011 at 05:47 PM
This bug will be fixed as part of the 3.5 release. It will not be fixed in Safari 3 and Firefox 3, but only in later browsers.
Hi Graham, do you know if it's possible to get early access to 3.5? $$anonymous$$y game is co$$anonymous$$g out soon.
Answer by Joshua · Apr 17, 2011 at 03:30 AM
If what you say is true I don't think there would be a simple workaround. Best thng I could advice is filing a bug report. It must be (I naively think) an easy bug to quash, seeing how the keys obviously give the machine different input signals. Strange.
Especially since it used to work properly in a previous version, although it's possible OS upgrades might have some effect.
Answer by Mortennobel · Apr 17, 2011 at 08:26 AM
DaveA has similar issues:
http://answers.unity3d.com/questions/51293/mac-keys-not-showing-up-or-very-strangely
Your answer
Follow this Question
Related Questions
Issues with Input.inputString 2 Answers
Mac Keys not showing up, or very strangely... 2 Answers
How to make floating mobile keyboard in mobile game ? 0 Answers
Android Hardware Keyboard 0 Answers