Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to get locale label of Physical Key using Input Manager

Discussion in 'Input System' started by guavaman, Nov 13, 2023.

  1. guavaman


    Nov 20, 2009
    This question is about the older Input Manager.

    Unity added the Physical Key option in Unity 2021.2 and made it enabled by default in 2022.0.

    I can't find a way to get the locale-correct label from the KeyCode when this option is enabled. This affects Rewired because, on all platforms except Windows, Rewired depends on Input.GetKey for keyboard input. Even on Windows, the user has the option to disable native keyboard handling and fall back to UnityEngine.Input for keyboard input. If this option is enabled, and it is in all projects now by default, glyphs and help text can only match the US 101-key layout. An AZERTY keyboard for example will return KeyCode.A when the Q key is pressed. Displaying "Press A to do something" when the action is mapped to Q is wrong and will frustrate and confuse players.

    Right now, my only option is to advise users to disable the Physical Key option. I am adding code to detect this and display a warning in the Rewired Input Manager if it is enabled.
    Last edited: Nov 14, 2023