- Home /
Mac Keys not showing up, or very strangely...
I'm trying to process as many keys on the keyboard as I can. I can see most keys on a standard PC keyboard using Event.current where .type is EventType.KeyDown. It does not pick up Shift and maps keypad Enter to Return.
On a Mac it's much worse, where none of the modifiers (shift/ctrl/alt/apple/capslock/fn) signal anything, most of the keys between F1 and F12 to 'system' things but don't show up as an event, and F16-F19 don't register at all either. Nor does Eject. Oddly, F16 through F19 DO trigger my Input.GetButtonDown("Prev") where Prev is defined in the Input manager as Page Down (!?)
What's going on? Is there a way to get these key events? Or do I have to explicitly look for GetKeyDown(KeyCode.LeftShift) and so forth? I'm not keen on that, as it means looping through the 300 or so keycodes all the time, looking for both key-down and key-up.
Note: I don't care what 'character' things map to, just that I get any kinda (unique) keycode at all. I saw a post that says using USER32.DLL would work on Windows, but I'm also on Mac, there's the problem. http://answers.unity3d.com/questions/11946/keycodes-for-non-us-keyboard-layouts
More info: I tried looping on all the keys with GetKeyDown/Up, and it does a better job, EXCEPT it doesn't get PrintScreen nor ScrollLock, but it DOES with Event.current !!! Still ignoring F16-19 as keycodes, but Input.GetButtonDown("Prev") still does register them. Yikes.
And just so's you know: with GetKeyDown/Up, you get both Left AND Right as down/up at the same time, even if you only press one or the other. Same true for alt, apple, control. On a Mac. On PC, left and right are separate, but you only get Shift keys with GetKeyDown/Up.
ALSO: On PC, Input will give you PrintScreen and ScrollLock, but ONLY ONCE and only the KeyDown! Pause will give you a KeyDown followed by a KeyUp regardless that it's still down!
Can someone please fix this in 3.4?
Sounds like someone did a really bad job at finding and standardizing same purpose code.
Hey Dave,
Is this basically the same thing I'm seeing here? http://answers.unity3d.com/questions/53015/on-mac-left-shift-and-right-shift-trigger-both-keys/53039#53039 Do we have a bug report in yet?
Answer by jonas-echterhoff · Jul 28, 2011 at 07:22 AM
This definitely sounds like a bug to me, and if you submitted it, we will look into fixing it.
Some background: There are a lot of different APIs involved to get input on different platforms. On Mac OS X alone, there are four different implementations of the input code chosen based on whether you run Unity as standalone, as a web player in old or new browsers and in fullscreen or windowed mode. So, there is a high chance for inconsistencies between implementations which are not always obvious at first sight. But we do try to fix them when we get bug reports!
As stated above, bug report submitted Apr 17 2011. Sorry to see it's not fixed in 3.4
Answer by Graham-Dunnett · Sep 26, 2011 at 05:48 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.
Your answer
Follow this Question
Related Questions
New Input System: Event on input type changed (between mouse, keyboard and controller) 1 Answer
checking for keyboard input with exceptions 0 Answers
On Mac "left shift" and "right shift" trigger both Keys 3 Answers
Is there a way to automatically detect if a game is running on a Mac or PC? 2 Answers
Issues with Input.inputString 2 Answers