Skip to content

Commit cd0de76

Browse files
authored
Merge branch 'develop' into isxb-1129-new-control-scheme-device-index
2 parents 6ff8dc2 + 790d9cc commit cd0de76

File tree

20 files changed

+531
-224
lines changed

20 files changed

+531
-224
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ however, it has to be formatted properly to pass verification tests.
3030
- Fixed tooltip support in the UI Toolkit version of the Input Actions Asset editor.
3131
- Fixed documentation to clarify bindings with modifiers `overrideModifiersNeedToBePressedFirst` configuration [ISXB-806](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-806).
3232
- Fixed an issue in `Samples/Visualizers/GamepadVisualizer.unity` sample where the visualization wouldn't handle device disconnects or current device changes properly (ISXB-1243).
33+
- Fixed an issue when displaying Serialized InputAction's Processor properties inside the Inspector window. [ISXB-1269](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1269)
3334
- Fixed an issue with default device selection when adding new Control Scheme.
3435

3536
### Changed
@@ -38,6 +39,9 @@ however, it has to be formatted properly to pass verification tests.
3839
- Changed paremeter `overrideModifiersNeedToBePressedFirst` to obsolete for `ButtonWithOneModifier`, `ButtonWithTwoModifiers`, `OneModifierComposite` and `TwoModifiersComposite` in favour the new `modifiersOrder` parameter which is more explicit.
3940
- Changed `Samples/Visualizers/GamepadVisualizer.unity` to visualize the control values of the current device instead of the first device.
4041

42+
### Added
43+
- Added new API `InputSystem.settings.useIMGUIEditorForAssets` that should be used in custom `InputParameterEditor` that use both IMGUI and UI Toolkit.
44+
4145
## [1.11.2] - 2024-10-16
4246

4347
### Fixed

Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ internal class AxisCompositeEditor : InputParameterEditor<AxisComposite>
220220
public override void OnGUI()
221221
{
222222
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
223-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
223+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
224224
#endif
225225
target.whichSideWins = (AxisComposite.WhichSideWins)EditorGUILayout.EnumPopup(m_WhichAxisWinsLabel, target.whichSideWins);
226226
}

Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ internal class Vector2CompositeEditor : InputParameterEditor<Vector2Composite>
200200
public override void OnGUI()
201201
{
202202
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
203-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
203+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
204204
#endif
205205
target.mode = (Vector2Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode);
206206
}

Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ internal class Vector3CompositeEditor : InputParameterEditor<Vector3Composite>
180180
public override void OnGUI()
181181
{
182182
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
183-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
183+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
184184
#endif
185185
target.mode = (Vector3Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode);
186186
}

Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected override void OnEnable()
125125
public override void OnGUI()
126126
{
127127
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
128-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
128+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
129129
#endif
130130
m_PressPointSetting.OnGUI();
131131
m_DurationSetting.OnGUI();

Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ protected override void OnEnable()
197197
public override void OnGUI()
198198
{
199199
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
200-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
200+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
201201
#endif
202202
target.tapCount = EditorGUILayout.IntField(m_TapCountLabel, target.tapCount);
203203
m_TapDelaySetting.OnGUI();

Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ protected override void OnEnable()
214214
public override void OnGUI()
215215
{
216216
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
217-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
217+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
218218
#endif
219219
EditorGUILayout.HelpBox(s_HelpBoxText);
220220
target.behavior = (PressBehavior)EditorGUILayout.EnumPopup(s_PressBehaviorLabel, target.behavior);

Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected override void OnEnable()
8989
public override void OnGUI()
9090
{
9191
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
92-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
92+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
9393
#endif
9494
m_DurationSetting.OnGUI();
9595
m_PressPointSetting.OnGUI();

Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected override void OnEnable()
103103
public override void OnGUI()
104104
{
105105
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
106-
if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) return;
106+
if (!InputSystem.settings.useIMGUIEditorForAssets) return;
107107
#endif
108108
m_DurationSetting.OnGUI();
109109
m_PressPointSetting.OnGUI();

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

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace UnityEngine.InputSystem
7777
/// which has APIs specific to the type of value of the control (e.g. <see cref="InputControl{TValue}.ReadValue()"/>.
7878
///
7979
/// The following example demonstrates various common operations performed on input controls:
80-
///
80+
/// </remarks>
8181
/// <example>
8282
/// <code>
8383
/// // Look up dpad/up control on current gamepad.
@@ -99,10 +99,7 @@ namespace UnityEngine.InputSystem
9999
/// leftStickHistory.Enable();
100100
/// </code>
101101
/// </example>
102-
/// <example>
103-
/// </example>
104-
/// </remarks>
105-
/// <see cref="InputControl{TValue}"/>
102+
/// <seealso cref="InputControl{TValue}"/>
106103
/// <seealso cref="InputDevice"/>
107104
/// <seealso cref="InputControlPath"/>
108105
/// <seealso cref="InputStateBlock"/>
@@ -611,6 +608,8 @@ public virtual unsafe void WriteValueFromObjectIntoState(object value, void* sta
611608
/// Note that if the given path matches multiple child controls, only the first control
612609
/// encountered in the search will be returned.
613610
///
611+
/// This method is equivalent to calling <see cref="InputControlPath.TryFindChild"/>.
612+
/// </remarks>
614613
/// <example>
615614
/// <code>
616615
/// // Returns the leftStick control of the current gamepad.
@@ -625,9 +624,6 @@ public virtual unsafe void WriteValueFromObjectIntoState(object value, void* sta
625624
/// Gamepad.current.TryGetChildControl("*stick");
626625
/// </code>
627626
/// </example>
628-
///
629-
/// This method is equivalent to calling <see cref="InputControlPath.TryFindChild"/>.
630-
/// </remarks>
631627
public InputControl TryGetChildControl(string path)
632628
{
633629
if (string.IsNullOrEmpty(path))
@@ -689,7 +685,7 @@ protected InputControl()
689685
/// <remarks>
690686
/// This method can be overridden to perform control- or device-specific setup work. The most
691687
/// common use case is for looking up child controls and storing them in local getters.
692-
///
688+
/// </remarks>
693689
/// <example>
694690
/// <code>
695691
/// public class MyDevice : InputDevice
@@ -706,7 +702,6 @@ protected InputControl()
706702
/// }
707703
/// </code>
708704
/// </example>
709-
/// </remarks>
710705
protected virtual void FinishSetup()
711706
{
712707
}
@@ -723,9 +718,12 @@ protected virtual void FinishSetup()
723718
///
724719
/// This method should be called if you are accessing cached data set up by
725720
/// <see cref="RefreshConfiguration"/>.
726-
///
721+
/// </remarks>
727722
/// <example>
728723
/// <code>
724+
/// using UnityEngine.InputSystem;
725+
/// using UnityEngine.InputSystem.Utilities;
726+
///
729727
/// // Let's say your device has an associated orientation which it can be held with
730728
/// // and you want to surface both as a property and as a usage on the device.
731729
/// // Whenever your backend code detects a change in orientation, it should send
@@ -779,7 +777,6 @@ protected virtual void FinishSetup()
779777
/// }
780778
/// </code>
781779
/// </example>
782-
/// </remarks>
783780
/// <seealso cref="RefreshConfiguration"/>
784781
protected void RefreshConfigurationIfNeeded()
785782
{
@@ -790,6 +787,61 @@ protected void RefreshConfigurationIfNeeded()
790787
}
791788
}
792789

790+
/// <summary>
791+
/// Refresh the configuration of the control. This is used to update the control's state (e.g. Keyboard Layout or display Name of Keys).
792+
/// </summary>
793+
/// <remarks>
794+
/// The system will call this method automatically whenever a change is made to one of the control's configuration properties.
795+
/// See <see cref="RefreshConfigurationIfNeeded"/>.
796+
/// </remarks>
797+
/// <example>
798+
/// <code>
799+
/// using UnityEngine.InputSystem;
800+
/// using UnityEngine.InputSystem.Utilities;
801+
///
802+
/// public class MyDevice : InputDevice
803+
/// {
804+
/// public enum Orientation
805+
/// {
806+
/// Horizontal,
807+
/// Vertical,
808+
/// }
809+
/// private Orientation m_Orientation;
810+
/// private static InternedString s_Vertical = new InternedString("Vertical");
811+
/// private static InternedString s_Horizontal = new InternedString("Horizontal");
812+
///
813+
/// public Orientation orientation
814+
/// {
815+
/// get
816+
/// {
817+
/// // Call RefreshOrientation if the configuration of the device has been
818+
/// // invalidated since last time we initialized m_Orientation.
819+
/// // Calling RefreshConfigurationIfNeeded() is sufficient in most cases, RefreshConfiguration() forces the refresh.
820+
/// RefreshConfiguration();
821+
/// return m_Orientation;
822+
/// }
823+
/// }
824+
/// protected override void RefreshConfiguration()
825+
/// {
826+
/// // Set Orientation back to horizontal. Alternatively fetch from device.
827+
/// m_Orientation = Orientation.Horizontal;
828+
/// // Reflect the orientation on the device.
829+
/// switch (m_Orientation)
830+
/// {
831+
/// case Orientation.Vertical:
832+
/// InputSystem.RemoveDeviceUsage(this, s_Horizontal);
833+
/// InputSystem.AddDeviceUsage(this, s_Vertical);
834+
/// break;
835+
///
836+
/// case Orientation.Horizontal:
837+
/// InputSystem.RemoveDeviceUsage(this, s_Vertical);
838+
/// InputSystem.AddDeviceUsage(this, s_Horizontal);
839+
/// break;
840+
/// }
841+
/// }
842+
/// }
843+
/// </code>
844+
/// </example>
793845
protected virtual void RefreshConfiguration()
794846
{
795847
}
@@ -902,8 +954,6 @@ protected virtual FourCC CalculateOptimizedControlDataType()
902954
/// <summary>
903955
/// Apply built-in parameters changes (e.g. <see cref="AxisControl.invert"/>, others), recompute <see cref="InputControl.optimizedControlDataType"/> for impacted controls and clear cached value.
904956
/// </summary>
905-
/// <remarks>
906-
/// </remarks>
907957
public void ApplyParameterChanges()
908958
{
909959
// First we go through all children of our own hierarchy

0 commit comments

Comments
 (0)