Search Unity

Bug UpArrow showing display name as "Num 8"?

Discussion in 'Input System' started by unormal, Nov 30, 2022.

  1. unormal

    unormal

    Joined:
    Jan 10, 2012
    Posts:
    65
    Code (CSharp):
    1. UnityEngine.Debug.Log(UnityEngine.InputSystem.Keyboard.current.upArrowKey.displayName);
    2. UnityEngine.Debug.Log(UnityEngine.InputSystem.Keyboard.current.upArrowKey.keyCode.ToString());
    displays in the log:

    Code (CSharp):
    1. Num 8
    2. UpArrow
    When I would expect it to say "Up Arrow" and "UpArrow".

    Is this expected behavior?
     
    BMRG14 likes this.
  2. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,347
    Hi, I am having similar issues just with another key.

    Code (CSharp):
    1. Debug.Log(Keyboard.current.aKey.displayName);
    2. // Returns  instead of A
    It happens on a german keyboard layout (qwertz). Unity 2020.3.30f1, InputSystem 1.3.0
    To be clear, what I expected was to get a plain "A", instead I got "Â" which is the lating A with a circumflex (U+00C2), c382

    I assume it has to do with none us keyboard layouts.

    Should we submit a bug report or is this to be expected?

    SideNote: I have seen there is a newer InputSystem version out (1.4.x), yet I do not see it in the package mananger as the official recommended version. Unity 2020 LTS is still officially supported. Will we get the 1.4.x InputSystem for 2020?
     
    Last edited: Nov 30, 2022
  3. rubendariohh

    rubendariohh

    Joined:
    Oct 14, 2017
    Posts:
    32
    Hi, Im also having this issue. Is extremely difficult to find anything in the forums about it. For me Up, Down, Left and Right Arrows are displaying as Num 8, Num 2, Num 6 and Num 4. This is an issue for Bindings and the tutorials of my game. Did you happend to find any solution yet?
     
  4. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,347
    Sadly no. I just manually fixed the displayNames for the keys I had troubles with and called it a day. Lesson learned: display names are not reliable in 1.3. Maybe upgrading to 1.4 will help. I have not yet tried that.
     
  5. rubendariohh

    rubendariohh

    Joined:
    Oct 14, 2017
    Posts:
    32
    Im using 1.4.4 and is not working neither. What is strange is that when I was using 1.3 with another version o f Unity it was working perfectly fine. Then I upgraded Unity to the last version and the issue appears. I downgrade the Input System to 1.3 and same issue.
     
  6. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,347
    Bump @jamesmcgill-dev : Trying to get someone from Unity in here. Should we submit an official bug or is thre something we don't understand about how displayName works?
     
    NibbleByte3 likes this.
  7. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    So damn annoying. Can confirm this is happening as well.
    Up, Down, Left and Right Arrows displaying as Num 8, Num 2, Num 6 and Num 4.
    Input system 1.4.4
     
  8. M-Horth21

    M-Horth21

    Joined:
    Mar 31, 2017
    Posts:
    1
    Had the same issue with:
    Input System 1.4.4
    Unity Editor 2021.3.17f1

    While debugging, I noticed it eventually got down to a level where it pulled the display name of an input control
    Code (CSharp):
    1.  
    2. public string displayName
    3.         {
    4.             get
    5.             {
    6.                 RefreshConfigurationIfNeeded();
    7.                 if (m_DisplayName != null)
    8.                     return m_DisplayName;
    9.                 if (m_DisplayNameFromLayout != null)
    10.                     return m_DisplayNameFromLayout;
    11.                 return m_Name;
    12.             }
    13.  
    While hovering over these fields, I saw that m_DisplayName was "Num 6", while m_DisplayNameFromLayout was "Right Arrow".

    I used this guide to make a local version of the Input System package that I could edit, and reordered those returns so that m_DisplayNameFromLayout would have priority. This property was on line 150 of InputControl.cs.

    Certainly not the way we'd want to fix it, and I'm sure Unity will get it sorted in the near future. But if anyone has a need to get this resolved now, this is a workaround.
     
    BMRG14 and _geo__ like this.
  9. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,347
    I think this should be reported as an official bug with the fix info you provided.

    Maintaining embedded packages is a chore and sadly error prone but good to know there is a better fix than guessing the right key string. Thank you :)
     
    NathBar likes this.