Skip to content

Commit 04a3e1b

Browse files
committed
fix code examples in InputControl and InputDevice
1 parent 0bddacb commit 04a3e1b

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Packages/com.unity.inputsystem/InputSystem/Controls/InputControl.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,9 @@ protected virtual void FinishSetup()
726726
///
727727
/// <example>
728728
/// <code>
729+
/// using UnityEngine.InputSystem;
730+
/// using UnityEngine.InputSystem.Utilities;
731+
///
729732
/// // Let's say your device has an associated orientation which it can be held with
730733
/// // and you want to surface both as a property and as a usage on the device.
731734
/// // Whenever your backend code detects a change in orientation, it should send
@@ -799,6 +802,9 @@ protected void RefreshConfigurationIfNeeded()
799802
/// </remarks>
800803
/// <example>
801804
/// <code>
805+
/// using UnityEngine.InputSystem;
806+
/// using UnityEngine.InputSystem.Utilities;
807+
///
802808
/// public class MyDevice : InputDevice
803809
/// {
804810
/// public enum Orientation
@@ -807,6 +813,8 @@ protected void RefreshConfigurationIfNeeded()
807813
/// Vertical,
808814
/// }
809815
/// private Orientation m_Orientation;
816+
/// private static InternedString s_Vertical = new InternedString("Vertical");
817+
/// private static InternedString s_Horizontal = new InternedString("Horizontal");
810818
///
811819
/// public Orientation orientation
812820
/// {
@@ -821,12 +829,8 @@ protected void RefreshConfigurationIfNeeded()
821829
/// }
822830
/// protected override void RefreshConfiguration()
823831
/// {
824-
/// // Fetch the current orientation from the backend. How you do this
825-
/// // depends on your device. Using DeviceCommands is one way.
826-
/// var fetchOrientationCommand = new FetchOrientationCommand();
827-
/// ExecuteCommand(ref fetchOrientationCommand);
828-
/// m_Orientation = fetchOrientation;
829-
///
832+
/// // Set Orientation back to horizontal. Alternatively fetch from device.
833+
/// m_Orientation = Orientation.Horizontal;
830834
/// // Reflect the orientation on the device.
831835
/// switch (m_Orientation)
832836
/// {

Packages/com.unity.inputsystem/InputSystem/Devices/InputDevice.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,11 @@ protected virtual void OnAdded()
527527
/// </remarks>
528528
/// <example>
529529
/// <code>
530+
/// using UnityEngine.InputSystem;
531+
///
530532
/// public class MyDevice : InputDevice
531533
/// {
534+
/// public static MyDevice current { get; private set; }
532535
/// protected override void OnRemoved()
533536
/// {
534537
/// // use this context to unassign the current device for instance

0 commit comments

Comments
 (0)