Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

leopard keyboard

Discussion in 'Editor & General Support' started by Lka, Oct 27, 2008.

  1. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    I don't know about other keys but in a leopard macbook (previous generation) the keys 123 (under the f1f2f3 keys) and 'w' are not working.
    only asd and arrow keys are working.

    in a ingame inputbox they are working.. nice.

    It's a Unity bug, any workaround?
    There is any known bug list somewhere?

    This is depressing..
     
  2. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    So, I had some time to test it.
    I have inserted a Debug.Log call in the OnGUI function

    Code (csharp):
    1.  
    2. if (Event.current.type.Equals(EventType.KeyDown))
    3. {
    4.   Debug.Log(string.Format( "character {0} keycode {1}", Event.current.character.ToString(), Event.current.keyCode));
    5. }
    6.  
    In imac tiger I get for keys 123w
    character 1 keycode Alpha1
    character 2 keycode Alpha2
    character 3 keycode Alpha3
    character w keycode W

    in macbook leopard I get
    character 1 keycode Ampersand
    character 2 keycode DoubleQuote
    character 3 keycode Quote
    character w keycode Z
     
  3. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    I'm remaking the input axis with keyup/keydown events and in tiger and leopard is working BUT in windows keycode and characters are EMPTY.

    Debug.Log(string.Format ( "keyup character {0} keycode {1}", Event.current.character , Event.current.keyCode.ToString ()));

    Please UT answer this thread. Is it a known bug? Do I have to check other values in windows?

    Thanks.
     
  4. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    Well, maybe you are right.. who bother if the player can't do fancy things like controlling the game.. he can always look at the demo,right?!

    Update:
    I have now both 'z' and 'w' key as positive axe. And I'm getting 123 keys with keydown event.
    Hoping this works on all keyboard localization under leopard.
    UT can you confirm that?
     
  5. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    FYI, I tested on a MacBook Pro running OS10.5.5 and get the same results as you get using an iMac running OS 10.4. So I'm not sure what's going on in your case or whether this has something to do with a MacBook versus a MacBook Pro. But at any rate I'm not sure it's a generic issue in Unity overall. If anyone else runs across this thread please give the code above a try in a simple new project, what results do you get? I'll put out a call for testing help with the guys in Copenhagen too, we'll see what results they get on Tiger and/or with a MacBook.


    I don't have a Windows machine handy here with me to test on at the moment so that too will have to be offered by my colleagues at company HQ. What code are you using to test on Windows? Is that part of an executable or web player content? If web player, what browser(s) and version(s) were you testing? What flavor(s) of Windows did you test on? I just want to get a handle on how/when/where you're testing on Windows so we can match our testing and results appropriately.


    The forums are growing and an incredible rate and it's getting tougher to stay on top of everything so we not be as immediately responsive to all issues as folks are used to. When that happens, instead of offering thoughts like the above simply ping one of us directly (I'm your best point of contact) and we'll get someone in there to lend a hand. I know I shared this information with you in particular in another thread but I'm citing it here as well in case others read this thread and not the other.

    Do note that we are starting to staff up in order get ahead of the curve with forum traffic. Please see Sam's post in Announcements about hiring on a new QA/support person, and then also know that we recently hired on full-time sales person (starts in a week or two when he relocates to SF) which will free me up for more forum patrol duty. :)
     
  6. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    And now I've heard from one of my colleagues who tested with Unity 2.1 on a MacBook running OS 10.4.11 and got the same results as I did and as you did on the iMac with OS 10.4. So I'm still not sure why your MacBook with OS 10.5 is behaving differently but hopefully the data is helping somewhat.
     
  7. ProtonOne

    ProtonOne

    Joined:
    Mar 8, 2008
    Posts:
    406
    I just tested it out on 3 computers.

    WebPlayer
    http://protonfoundry.com/KeyboardTest/

    Mac OS X 10.5.5 (Safari FF3)
    Code (csharp):
    1. character 1 keycode Alpha1
    2. character 2 keycode Alpha2
    3. character 3 keycode Alpha3
    4. character w keycode W
    Windows XP Pro SP2 IE7 FF3
    Windows Vista Home Premium IE7 FF3
    Code (csharp):
    1. character  keycode Alpha1
    2. character 1 keycode 0
    3. character  keycode Alpha2
    4. character 2 keycode 0
    5. character  keycode Alpha3
    6. character 3 keycode 0
    7. character  keycode W
    8. character w keycode 0

    My Vista computer acts a little strange though in IE7. The Input.inputString never gets input and the cube does not move. But it is registering the events and typing out the correct character and keycode data.

    I thought it may be related, but it doesn't look like it is.


    Code (csharp):
    1. private var inputStringConcat : String = "";
    2. private var textFieldValue : String = "";
    3.  
    4. private var logStrings : Queue= new Queue();
    5.  
    6. var cube : Transform;
    7.  
    8. function Update () {
    9.     inputStringConcat += Input.inputString;
    10.     cube.Translate( Input.GetAxis("Horizontal") * Time.deltaTime, Input.GetAxis("Vertical") * Time.deltaTime, 0 );
    11. }
    12.  
    13. function OnGUI()
    14. {
    15.     GUILayout.BeginArea( Rect(50, 5, 500, 50) );
    16.         GUILayout.BeginVertical("box");
    17.        
    18.             GUILayout.Label( "Input.inputString cumulative"  );
    19.             GUILayout.Label( inputStringConcat );
    20.             GUILayout.Space( 10 );
    21.                        
    22.         GUILayout.EndVertical();
    23.     GUILayout.EndArea();
    24.    
    25.     GUILayout.BeginArea( Rect(50, 60, 500, 400), "", "box" );
    26.         for( var curLog : String in logStrings ){
    27.             GUILayout.Label( curLog );
    28.         }
    29.     GUILayout.EndArea();
    30.    
    31.     if (Event.current.type.Equals(EventType.KeyDown))
    32.     {
    33.       logStrings.Enqueue( String.Format( "character {0} keycode {1}", Event.current.character.ToString(), Event.current.keyCode));
    34.       if( logStrings.Count > 16 ){
    35.         logStrings.Dequeue();
    36.       }
    37.     }
    38. }
     
  8. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    Thanks for tests.

    I think the bug is related to non-US macbook keyboard with leopard.
    I have tested it with a deployed application ".app".

    Another keyboard bug I found in osx (but I don't remember if it was with leopard or tiger): if you keep pressed a key ('w') then press the ctrl or fn key and release the key ('w') you get a keyup event without the keycode.

    I don't know if it's related but the application was build in tiger and deployed in leopard.

    About windows version, I have tested it in a parallels vm xp and in a "real pc" windows 2000, with the same error.
     
  9. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Ran the test on my mbp with a danish keyboard. Characters and keycodes match.
     
  10. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    In this site
    http://www.pc-facile.com/glossario/qwerty_qzerty_qwertz/

    you can read this sentence:
    QZERTY (layout italiano, utilizzato nelle machcine da scrivere e nei vecchi modelli di Mac)

    QZERTY (italian layout, used in typewriters and older Mac computers)

    Well, I have an italian macbook.
     
  11. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,061
    Did you try selecting a different keyboard layout?

    IIRC there are two for each language on laptops: A generic one and another one specifically for the MacBook.

    I'm using a Microsoft USB keyboard with my Mac and get a choice between the default swiss-german layout and a microsoft swiss-german layout. The second one maps the labels correctly to the function while the first maps the default osx shortcuts.

    Anyway, I noticed some applications behave strangely depending on which layout I have selected. Like FinalCut not registering a lot of keys with the generic layout and other applications with the microsoft one.

    Also, there might be additional strangeness with some local keyboard layouts. For example, with the swiss-german layout the number pad's dot doesn't worky correctly with osx's calculator app. It always makes a comma and all calculations return an error. I guess it's either a bug in the keyboard layout or the calculator app.
     
  12. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    No and this is not the point: if a user dowload the game to test it and he can't play probably he trash the application without testing it with different layouts.

    I'll publish a small app this night to test the keyboard, something like Proton's one but only with keyup/down events because the TextField was working even in my mac and probably it use the inputString method.
     
  13. nikemerlino

    nikemerlino

    Joined:
    Jul 2, 2008
    Posts:
    66
    Same problem.
    Today I have bought the new MacBook pro 15 with 10.5.5 under italian setup
    If i run Island demo on the web the w key translate the camera in the right way.
    Inside Unity with Island demo the w key doesn't work.
    If I change the key the "vertical" input runs right. At the moment I have only a problem with the w key.
     
  14. Lka

    Lka

    Joined:
    Aug 6, 2006
    Posts:
    297
    Test update:
    I tested this code

    Code (csharp):
    1. using System;
    2. using System.Collections;
    3. using UnityEngine;
    4.  
    5. class testKeys:MonoBehaviour
    6. {
    7.     Queue q = new Queue();
    8.     GUILayoutOption[] op = null;
    9.     void OnGUI()
    10.     {
    11.  
    12.         if (Event.current.type.Equals(EventType.KeyDown))
    13.         {
    14.             q.Enqueue(string.Format("KeyDown character {0} keycode {1}", Event.current.character.ToString(), Event.current.keyCode));
    15.         }
    16.         if (Event.current.type.Equals(EventType.KeyUp ))
    17.         {
    18.             q.Enqueue(string.Format("KeyUp character {0} keycode {1}", Event.current.character.ToString(), Event.current.keyCode));
    19.         }
    20.         while (q.Count > 18)
    21.             q.Dequeue();
    22.         GUILayout.BeginArea(new Rect(50, 10, 500, 580));
    23.         foreach (string t in q)
    24.             GUILayout.Label(t,op );
    25.         GUILayout.EndArea();
    26.     }
    27. }
    28.  
    29.  
    The webplayer is working in tiger and leopard safari ('control' key keydown keyup missing)
    In a deployed application

    - Leopard macbook
    KeyDown character 1 keycode Ampersand
    KeyUp character 1 keycode Ampersand
    KeyDown character 2 keycode DoubleQuote
    KeyUp character 2 keycode DoubleQuote
    KeyDown character 3 keycode Quote
    KeyUp character 3 keycode Quote
    KeyDown character w keycode Z
    KeyUp character w keycode Z
    keydown keyup 'control' key event missing
    -Tiger
    KeyDown character 1 keycode Alpha1
    KeyUp character 1 keycode Alpha1
    KeyDown character 2 keycode Alpha2
    KeyUp character 2 keycode Alpha2
    KeyDown character 3 keycode Alpha3
    KeyUp character 3 keycode Alpha3
    KeyDown character w keycode W
    KeyUp character w keycode W
    keydown keyup 'control' key event missing
    - Windows XP
    KeyDown character keycode Alpha1
    KeyDown character 1 keycode 0
    KeyUp character keycode Alpha1
    KeyDown character keycode Alpha2
    KeyDown character 2 keycode 0
    KeyUp character keycode Alpha2
    KeyDown character keycode Alpha3
    KeyDown character 3 keycode 0
    KeyUp character keycode Alpha3
    KeyDown character keycode W
    KeyDown character w keycode 0
    KeyUp character keycode W
    KeyDown character keycode LeftControl
    KeyUp character keycode LeftControl
     
  15. Deleted User

    Deleted User

    Guest

    I have the same problem with my Macbook Pro. (italian keyboard)

    -In Unity 2.5 W and Z are swapped in the editor functions (like i had a QZERTY keybard):
    if in the key editor preferences i press W i see written Z..
    but if i change names in the project when i press W i see correctly W
    Example in FPS command editor to go forward i have to press Z


    -if i build a webplayer example all works correctly
    -In Unity iPhone editor is all ok.

    I have just reported the issue.

    Andrea
     
  16. tinycolossus

    tinycolossus

    Joined:
    Jul 24, 2011
    Posts:
    2
    I am experiencing the same issue here, and alas, I have an italian Macbook Pro as well.
    Just to recap:

    I have an Unity project with a vertical axis defined in the controls, with these keys:
    - Negative button: down
    - Positive button: up
    - Alt Negative button: s
    - Alt Positive button: w
    When I am working inside the editor, if I press 'W' I see the pivot button flipping from 'Pivot' to 'Center', instead of selecting the translation gizmo. 'Q', 'E' and 'R' work.
    Likewise, if I play the game hitting Cmd+P, the 'W' doesn't work and I have to press 'Z' to move.
    Basically, 'W' acts as if it was a 'Z', as if I were using the old italian keyboard layout, the QZERTY.

    If I build the game and play it, everything works fine.

    Just to clarify, I am NOT using the QZERTY layout. I have made a test with the other italian keyboard enabled, I also tried to switch back and forth between keyboard layouts while the game was running, I restarted Unity after re-selecting the correct layout, nothing changes.
    It's like as if Unity switches to using the QZERTY layout in the background without even telling the system.

    Thank you if you're going to look into this issue, it's very annoying.
     
  17. Dabeh

    Dabeh

    Joined:
    Oct 26, 2011
    Posts:
    1,614
    Necro. That is all.
     
  18. tinycolossus

    tinycolossus

    Joined:
    Jul 24, 2011
    Posts:
    2
    Necro what? I know the thread was old, but I still have the issue now!
     
  19. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    Not to derail the thread too much, but I'll just leave this here:

    http://xkcd.com/1031/

    Unfortunately, I don't know of any (real) solutions for those problems. I suggest submitting a bug report with a link to this thread.
     
  20. Azzel

    Azzel

    Joined:
    Feb 13, 2012
    Posts:
    3
    I have the problems looks quite the same. WASD not working unde Mac OS Lion
    Input.GetKey("u")/Input.GetKey(KeyCode.U) and similar characters not catched, but getkey ("8"), getkey("up") catched very nice. Looks like some problem with character coding or layouts.

    More strange, that it sometimes work! And on another day (after reboot) - not.
    It's annoing me.