@@ -12,9 +12,27 @@ namespace UnityEngine.InputSystem.Controls
1212 /// have symbols associated with them which may change depending on keyboard layout as well as in combination
1313 /// with other keys.
1414 ///
15- /// Note that there is no text input associated with individual keys as text composition is highly
16- /// layout specific and does not need to be key-by-key. For general text input, see <see cref="Keyboard.onTextInput"/>.
17- /// To find the text displayed on a key, use <see cref="InputControl.displayName"/>.
15+ /// Note:
16+ /// Unity input system key codes and input manager key codes are designed with game controls in mind.
17+ ///
18+ /// This means the way they are assigned is intended to preserve the location of keys on keyboards,
19+ /// so that pressing a key in the same location on different keyboards should result in the same action
20+ /// regardless of what is printed on a key or what current system language is set.
21+ ///
22+ /// This means, for example, that <see cref="Key.A"/> is always the key to the right of <see cref="Key.CapsLock"/>,
23+ /// regardless of which key (if any) produces the "a" character on the current keyboard layout.
24+ ///
25+ /// Unity relies on physical hardware in the keyboards to report same USB HID "usage" for the keys in
26+ /// the same location.This puts a practical limit on what can be achieved, because different keyboards
27+ /// might report different data, and this is outside of Unity's control.
28+ ///
29+ /// For this reason, you should not use key codes to read text input.
30+ /// Instead, you should use the <see cref="Keyboard.onTextInput"/> callback.
31+ /// The `onTextInput` callback provides you with the actual text characters which correspond
32+ /// to the symbols printed on a keyboard, based on the end user's current system language layout.
33+ ///
34+ /// To find the text character (if any) generated by a key according to the currently active keyboard
35+ /// layout, use the <see cref="InputControl.displayName"/> property of <see cref="KeyControl"/>.
1836 /// </remarks>
1937 public class KeyControl : ButtonControl
2038 {
@@ -24,6 +42,7 @@ public class KeyControl : ButtonControl
2442 /// <remarks>
2543 /// This property must be initialized by <see cref="InputControl.FinishSetup"/> of
2644 /// the device owning the control.
45+ /// You should not use `keyCode` to read text input. For more information, <see cref="KeyControl"/>
2746 /// </remarks>
2847 public Key keyCode { get ; set ; }
2948
0 commit comments