@@ -20,9 +20,19 @@ namespace UnityEngine.InputSystem.LowLevel
2020 ///
2121 /// <example>
2222 /// <code>
23- /// // Send input event with A key pressed on keyboard.
24- /// InputSystem.QueueStateEvent(Keyboard.current,
25- /// new KeyboardState(Key.A));
23+ /// using UnityEngine;
24+ /// using UnityEngine.InputSystem;
25+ /// using UnityEngine.InputSystem.LowLevel;
26+ ///
27+ /// public class Example : MonoBehaviour
28+ /// {
29+ /// void Start()
30+ /// {
31+ /// // Send input event with A key pressed on keyboard.
32+ /// InputSystem.QueueStateEvent(Keyboard.current,
33+ /// new KeyboardState(Key.A));
34+ /// }
35+ /// }
2636 /// </code>
2737 /// </example>
2838 /// </remarks>
@@ -222,11 +232,20 @@ namespace UnityEngine.InputSystem
222232 ///
223233 /// <example>
224234 /// <code>
225- /// // Look up key by key code.
226- /// var aKey = Keyboard.current[Key.A] ;
235+ /// using UnityEngine;
236+ /// using UnityEngine.InputSystem ;
227237 ///
228- /// // Find out which text is produced by the key.
229- /// Debug.Log($"The '{aKey.keyCode}' key produces '{aKey.displayName}' as text input");
238+ /// public class Example : MonoBehaviour
239+ /// {
240+ /// void LookUpTextInputByKey()
241+ /// {
242+ /// // Look up key by key code.
243+ /// var aKey = Keyboard.current[Key.A];
244+ ///
245+ /// // Find out which text is produced by the key.
246+ /// Debug.Log($"The '{aKey.keyCode}' key produces '{aKey.displayName}' as text input");
247+ /// }
248+ /// }
230249 /// </code>
231250 /// </example>
232251 /// </remarks>
@@ -877,6 +896,9 @@ public enum Key
877896 /// </remarks>
878897 /// <example>
879898 /// <code>
899+ /// using UnityEngine;
900+ /// using UnityEngine.InputSystem;
901+ ///
880902 /// public class InputExample : MonoBehaviour
881903 /// {
882904 /// private string inputText = "";
@@ -914,6 +936,10 @@ public class Keyboard : InputDevice, ITextInputReceiver
914936 /// </summary>
915937 /// <example>
916938 /// <code>
939+ /// using System;
940+ /// using UnityEngine;
941+ /// using UnityEngine.InputSystem;
942+ ///
917943 /// // Let's say we want to do a typing game. We could define a component
918944 /// // something along those lines to match the typed input.
919945 /// public class MatchTextByTyping : MonoBehaviour
@@ -953,7 +979,7 @@ public class Keyboard : InputDevice, ITextInputReceiver
953979 /// {
954980 /// ++m_Position;
955981 /// if (m_Position == m_Text.Length)
956- /// onTextTypeCorrectly ?.Invoke();
982+ /// onTextTypedCorrectly ?.Invoke();
957983 /// }
958984 /// else
959985 /// {
@@ -997,6 +1023,9 @@ public event Action<char> onTextInput
9971023 /// <example>
9981024 /// <para>To subscribe to the onIMECompositionChange event, use the following sample code:</para>
9991025 /// <code>
1026+ /// using UnityEngine;
1027+ /// using UnityEngine.InputSystem;
1028+ ///
10001029 /// public class KeyboardUtils : MonoBehaviour
10011030 /// {
10021031 /// private string compositionString = "";
@@ -1039,6 +1068,9 @@ public event Action<IMECompositionString> onIMECompositionChange
10391068 /// </param>
10401069 /// <example>
10411070 /// <code>
1071+ /// using UnityEngine;
1072+ /// using UnityEngine.InputSystem;
1073+ ///
10421074 /// public class KeyboardUtils : MonoBehaviour
10431075 /// {
10441076 /// private string compositionString = "";
@@ -1073,6 +1105,9 @@ public void SetIMEEnabled(bool enabled)
10731105 /// </param>
10741106 /// <example>
10751107 /// <code>
1108+ /// using UnityEngine;
1109+ /// using UnityEngine.InputSystem;
1110+ ///
10761111 /// public class KeyboardUtils : MonoBehaviour
10771112 /// {
10781113 /// private Vector2 cursorPosition;
@@ -2086,6 +2121,9 @@ public KeyControl this[Key key]
20862121 /// </remarks>
20872122 /// <example>
20882123 /// <code>
2124+ /// using UnityEngine;
2125+ /// using UnityEngine.InputSystem;
2126+ ///
20892127 /// public class InputExample : MonoBehaviour
20902128 /// {
20912129 /// void Start()
@@ -2121,14 +2159,17 @@ protected override void OnRemoved()
21212159 ///</remarks>
21222160 /// <example>
21232161 /// <code>
2162+ /// using UnityEngine.InputSystem;
2163+ /// using UnityEngine.InputSystem.Controls;
2164+ ///
21242165 /// public class MyKeyboard : Keyboard
21252166 /// {
21262167 /// public ButtonControl button { get; private set; }
21272168 ///
21282169 /// protected override void FinishSetup()
21292170 /// {
21302171 /// // Cache controls in getters.
2131- /// button = GetChildControl("button");
2172+ /// button = (ButtonControl) GetChildControl("button");
21322173 /// }
21332174 /// }
21342175 /// </code>
@@ -2287,6 +2328,9 @@ protected override void RefreshConfiguration()
22872328 /// </remarks>
22882329 /// <example>
22892330 /// <code>
2331+ /// using UnityEngine;
2332+ /// using UnityEngine.InputSystem;
2333+ ///
22902334 /// public class UserTest : MonoBehaviour
22912335 /// {
22922336 /// // Simulate text input event on the current keyboard.
@@ -2317,6 +2361,9 @@ public void OnTextInput(char character)
23172361 /// </remarks>
23182362 /// <example>
23192363 /// <code>
2364+ /// using UnityEngine;
2365+ /// using UnityEngine.InputSystem;
2366+ ///
23202367 /// public class KeyboardUtils : MonoBehaviour
23212368 /// {
23222369 /// private void FindKey()
@@ -2346,14 +2393,17 @@ public KeyControl FindKeyOnCurrentKeyboardLayout(string displayName)
23462393 /// </remarks>
23472394 /// <example>
23482395 /// <code>
2396+ /// using UnityEngine;
2397+ /// using UnityEngine.InputSystem;
2398+ /// using UnityEngine.InputSystem.LowLevel;
2399+ ///
23492400 /// public class KeyboardUtils : MonoBehaviour
23502401 /// {
23512402 /// private string compositionString = "";
2352- ///
2353- /// void ChangeIMEComposition ()
2403+ /// void ChangeIMEComposition()
23542404 /// {
23552405 /// // Manually creating an input event to change the IME composition
2356- /// var inputEvent = IMECompositionEvent.Create(Keyboard.current.deviceId, "CompositionTestCharacters! ɝ", InputRuntime.s_Instance.currentTime );
2406+ /// var inputEvent = IMECompositionEvent.Create(Keyboard.current.deviceId, "CompositionTestCharacters! ɝ", Time.time );
23572407 /// Keyboard.current.OnIMECompositionChanged(inputEvent.compositionString);
23582408 /// }
23592409 /// }
0 commit comments