Skip to content

Commit 15eac7b

Browse files
authored
Merge branch 'develop' into isxb-1351-parameter-editor-default-value-fix
2 parents 0213cb3 + c1222db commit 15eac7b

17 files changed

+167
-44
lines changed

Assets/Tests/InputSystem/Plugins/UITests.cs

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2911,10 +2911,16 @@ public IEnumerator UI_CanDriveUIFromGamepad()
29112911
Assert.That(scene.leftChildReceiver.events,
29122912
EventSequence(
29132913
OneEvent("type", EventType.Move),
2914+
OneEvent("device", gamepad),
29142915
OneEvent("moveDir", MoveDirection.Right),
29152916
OneEvent("moveVector", gamepad.leftStick.ReadValue())));
29162917
Assert.That(scene.rightChildReceiver.events, Is.Empty);
29172918

2919+
#if UNITY_INPUT_SYSTEM_INPUT_MODULE_NAVIGATION_DEVICE_TYPE
2920+
Assert.That(scene.uiModule.GetNavigationEventDeviceType(scene.leftChildReceiver.events[0].data),
2921+
Is.EqualTo(NavigationDeviceType.NonKeyboard));
2922+
#endif
2923+
29182924
scene.leftChildReceiver.events.Clear();
29192925

29202926
// Move left.
@@ -2924,6 +2930,7 @@ public IEnumerator UI_CanDriveUIFromGamepad()
29242930
Assert.That(scene.leftChildReceiver.events,
29252931
EventSequence(
29262932
OneEvent("type", EventType.Move),
2933+
OneEvent("device", gamepad),
29272934
OneEvent("moveDir", MoveDirection.Left),
29282935
OneEvent("moveVector", gamepad.leftStick.ReadValue())));
29292936
Assert.That(scene.rightChildReceiver.events, Is.Empty);
@@ -2937,6 +2944,7 @@ public IEnumerator UI_CanDriveUIFromGamepad()
29372944
Assert.That(scene.leftChildReceiver.events,
29382945
EventSequence(
29392946
OneEvent("type", EventType.Move),
2947+
OneEvent("device", gamepad),
29402948
OneEvent("moveDir", MoveDirection.Up),
29412949
OneEvent("moveVector", gamepad.leftStick.ReadValue())));
29422950
Assert.That(scene.rightChildReceiver.events, Is.Empty);
@@ -2950,6 +2958,7 @@ public IEnumerator UI_CanDriveUIFromGamepad()
29502958
Assert.That(scene.leftChildReceiver.events,
29512959
EventSequence(
29522960
OneEvent("type", EventType.Move),
2961+
OneEvent("device", gamepad),
29532962
OneEvent("moveDir", MoveDirection.Down),
29542963
OneEvent("moveVector", gamepad.leftStick.ReadValue())));
29552964
Assert.That(scene.rightChildReceiver.events, Is.Empty);
@@ -2964,6 +2973,7 @@ public IEnumerator UI_CanDriveUIFromGamepad()
29642973
Assert.That(scene.leftChildReceiver.events,
29652974
EventSequence(
29662975
OneEvent("type", EventType.Move),
2976+
OneEvent("device", gamepad),
29672977
OneEvent("moveDir", MoveDirection.Down),
29682978
OneEvent("moveVector", gamepad.leftStick.ReadValue())));
29692979

@@ -2977,6 +2987,7 @@ public IEnumerator UI_CanDriveUIFromGamepad()
29772987
Assert.That(scene.leftChildReceiver.events,
29782988
EventSequence(
29792989
OneEvent("type", EventType.Move),
2990+
OneEvent("device", gamepad),
29802991
OneEvent("moveDir", MoveDirection.Down),
29812992
OneEvent("moveVector", gamepad.leftStick.ReadValue())));
29822993

@@ -2986,7 +2997,12 @@ public IEnumerator UI_CanDriveUIFromGamepad()
29862997
PressAndRelease(gamepad.buttonSouth);
29872998
yield return null;
29882999

2989-
Assert.That(scene.leftChildReceiver.events, EventSequence(OneEvent("type", EventType.Submit)));
3000+
Assert.That(scene.leftChildReceiver.events,
3001+
EventSequence(
3002+
OneEvent("type", EventType.Submit),
3003+
OneEvent("device", gamepad)
3004+
)
3005+
);
29903006
Assert.That(scene.rightChildReceiver.events, Is.Empty);
29913007

29923008
scene.leftChildReceiver.events.Clear();
@@ -2995,7 +3011,12 @@ public IEnumerator UI_CanDriveUIFromGamepad()
29953011
PressAndRelease(gamepad.buttonEast);
29963012
yield return null;
29973013

2998-
Assert.That(scene.leftChildReceiver.events, EventSequence(OneEvent("type", EventType.Cancel)));
3014+
Assert.That(scene.leftChildReceiver.events,
3015+
EventSequence(
3016+
OneEvent("type", EventType.Cancel),
3017+
OneEvent("device", gamepad)
3018+
)
3019+
);
29993020
Assert.That(scene.rightChildReceiver.events, Is.Empty);
30003021

30013022
scene.leftChildReceiver.events.Clear();
@@ -4463,6 +4484,7 @@ public struct Event
44634484
public BaseEventData data { get; }
44644485
public AxisEventData axisData => (AxisEventData)data;
44654486
public ExtendedPointerEventData pointerData => (ExtendedPointerEventData)data;
4487+
public INavigationEventData navigationData => (INavigationEventData)data;
44664488

44674489
public Event(EventType type, BaseEventData data)
44684490
{
@@ -4521,12 +4543,12 @@ public void OnMove(AxisEventData eventData)
45214543

45224544
public void OnSubmit(BaseEventData eventData)
45234545
{
4524-
events.Add(new Event(EventType.Submit, null));
4546+
events.Add(new Event(EventType.Submit, CloneSubmitCancelEventData(eventData)));
45254547
}
45264548

45274549
public void OnCancel(BaseEventData eventData)
45284550
{
4529-
events.Add(new Event(EventType.Cancel, null));
4551+
events.Add(new Event(EventType.Cancel, CloneSubmitCancelEventData(eventData)));
45304552
}
45314553

45324554
public void OnSelect(BaseEventData eventData)
@@ -4579,11 +4601,20 @@ private static AxisEventData CloneAxisEventData(AxisEventData eventData)
45794601
{
45804602
return new ExtendedAxisEventData(EventSystem.current)
45814603
{
4604+
device = (eventData as ExtendedAxisEventData)?.device,
45824605
moveVector = eventData.moveVector,
45834606
moveDir = eventData.moveDir
45844607
};
45854608
}
45864609

4610+
private static ExtendedSubmitCancelEventData CloneSubmitCancelEventData(BaseEventData eventData)
4611+
{
4612+
return new ExtendedSubmitCancelEventData(EventSystem.current)
4613+
{
4614+
device = (eventData as ExtendedSubmitCancelEventData)?.device
4615+
};
4616+
}
4617+
45874618
private static ExtendedPointerEventData ClonePointerEventData(PointerEventData eventData)
45884619
{
45894620
// InputSystemUIInputModule should only be sending ExtendedPointEventData.

Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
"expression": "6000.0.11",
5252
"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_SCROLL_DELTA"
5353
},
54+
{
55+
"name": "Unity",
56+
"expression": "6000.2.0a4",
57+
"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_NAVIGATION_DEVICE_TYPE"
58+
},
5459
{
5560
"name": "Unity",
5661
"expression": "6000.0.15",

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ however, it has to be formatted properly to pass verification tests.
1313
### Fixed
1414
- Fixed an issue where removing a newly created action in the Asset Editor would cause an exception. [UUM-95693](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-95693)
1515
- Fixed arrow key navigation of Input Actions after Action rename. [ISXB-1024](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1024)
16+
- Fixed gamepad navigation in UI Toolkit TextField when using InputSystemUIInputModule. [UUM-77364](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-77364)
17+
- Fixed issue where asset editor window splitter positions were not persisted [ISXB-1316]
1618

1719
## [1.13.0] - 2025-02-05
1820

@@ -23,6 +25,7 @@ however, it has to be formatted properly to pass verification tests.
2325
- Fixed an issue causing InvalidOperationException when entering playmode with domain reload disabled. [ISXB-1208](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1208).
2426
- Fixed an issue where compiling Addressables with Input System package present would result in failed compilation due to `IInputAnalytic.TryGatherData` not being defined [ISXB-1203](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1203).
2527
- Pinned Touch Samples sample package dependencies to avoid errors with Cinemachine 3.x and Probuilder 6.x. [ISXB-1245](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1245)
28+
- Fixed issue where a binding path is sometimes not saved when chosen from the binding path picker. [ISXB-1221](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1221)
2629
- Fixed an issue where dropdown menu for Path in Input Actions Editor could not be selected from any button position. [ISXB-1309](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1309)
2730
- Fixed an issue where changing Input System default parameter settings with the editor open would result in changes in the editor. [ISXB-1351](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1351)
2831

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,17 @@ public InputControlPathEditor(SerializedProperty pathProperty, InputControlPicke
3030
{
3131
if (pathProperty == null)
3232
throw new ArgumentNullException(nameof(pathProperty));
33-
34-
this.pathProperty = pathProperty;
33+
// Update the static pathProperty variable to the most recent serializedProperty.
34+
// See comment on pathProperty for more information.
35+
s_pathProperty = pathProperty;
3536
this.onModified = onModified;
3637
m_PickerState = pickerState ?? new InputControlPickerState();
3738
m_PathLabel = label ?? new GUIContent(pathProperty.displayName, pathProperty.GetTooltip());
3839
}
3940

4041
public void Dispose()
4142
{
43+
s_pathProperty = null;
4244
m_PickerDropdown?.Dispose();
4345
}
4446

@@ -89,10 +91,10 @@ public void OnGUI()
8991
EditorGUILayout.EndHorizontal();
9092
}
9193

94+
//TODO: on next major version remove property argument.
9295
public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty property = null, Action modifiedCallback = null)
9396
{
9497
var pathLabel = label ?? m_PathLabel;
95-
var serializedProperty = property ?? pathProperty;
9698

9799
var lineRect = rect;
98100
var labelRect = lineRect;
@@ -113,7 +115,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
113115
var path = String.Empty;
114116
try
115117
{
116-
path = serializedProperty.stringValue;
118+
path = pathProperty.stringValue;
117119
}
118120
catch
119121
{
@@ -138,8 +140,8 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
138140
path = EditorGUI.DelayedTextField(bindingTextRect, path);
139141
if (EditorGUI.EndChangeCheck())
140142
{
141-
serializedProperty.stringValue = path;
142-
serializedProperty.serializedObject.ApplyModifiedProperties();
143+
pathProperty.stringValue = path;
144+
pathProperty.serializedObject.ApplyModifiedProperties();
143145
(modifiedCallback ?? onModified).Invoke();
144146
}
145147
}
@@ -148,9 +150,9 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
148150
// Dropdown that shows binding text and allows opening control picker.
149151
if (EditorGUI.DropdownButton(bindingTextRect, new GUIContent(displayName), FocusType.Keyboard))
150152
{
151-
SetExpectedControlLayoutFromAttribute(serializedProperty);
153+
SetExpectedControlLayoutFromAttribute(pathProperty);
152154
////TODO: for bindings that are part of composites, use the layout information from the [InputControl] attribute on the field
153-
ShowDropdown(bindingTextRect, serializedProperty, modifiedCallback ?? onModified);
155+
ShowDropdown(bindingTextRect, modifiedCallback ?? onModified);
154156
}
155157
}
156158

@@ -159,7 +161,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
159161
EditorStyles.miniButton);
160162
}
161163

162-
private void ShowDropdown(Rect rect, SerializedProperty serializedProperty, Action modifiedCallback)
164+
private void ShowDropdown(Rect rect, Action modifiedCallback)
163165
{
164166
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
165167
InputActionsEditorSettingsProvider.SetIMGUIDropdownVisible(true, false);
@@ -170,19 +172,13 @@ private void ShowDropdown(Rect rect, SerializedProperty serializedProperty, Acti
170172
m_PickerState,
171173
path =>
172174
{
173-
serializedProperty.stringValue = path;
175+
pathProperty.stringValue = path;
176+
pathProperty.serializedObject.ApplyModifiedProperties();
174177
m_PickerState.manualPathEditMode = false;
175178
modifiedCallback();
176179
});
177180
}
178181

179-
m_PickerDropdown.SetPickedCallback(path =>
180-
{
181-
serializedProperty.stringValue = path;
182-
m_PickerState.manualPathEditMode = false;
183-
modifiedCallback();
184-
});
185-
186182
m_PickerDropdown.SetControlPathsToMatch(m_ControlPathsToMatch);
187183
m_PickerDropdown.SetExpectedControlLayout(m_ExpectedControlLayout);
188184

@@ -200,7 +196,16 @@ private void SetExpectedControlLayoutFromAttribute(SerializedProperty property)
200196
SetExpectedControlLayout(attribute.layout);
201197
}
202198

203-
public SerializedProperty pathProperty { get; }
199+
// This static variable is a hack. Because the editor is rebuilt at unpredictable times with a new serializedObject, we need to keep updating
200+
// this variable with most up to date serializedProperty, so that the picker dropdown can access the correct serializedProperty.
201+
// The picker dropdown is a separate window and does not have access to the changed serializedObject reference.
202+
// This could be removed if the InputControlPathEditor is converted to UITK with a stable, persistent serializedObject backing this editor.
203+
// This property will be shared among multiple asset editor windows.
204+
private static SerializedProperty s_pathProperty { get; set; }
205+
206+
// This property will always return the most recent serializedProperty.
207+
public SerializedProperty pathProperty { get => s_pathProperty;}
208+
204209
public Action onModified { get; }
205210

206211
private GUIContent m_PathLabel;

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPickerDropdown.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ public void SetExpectedControlLayout(string expectedControlLayout)
5858
Reload();
5959
}
6060

61-
public void SetPickedCallback(Action<string> action)
62-
{
63-
m_OnPickCallback = action;
64-
}
65-
6661
protected override void OnDestroy()
6762
{
6863
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS

Packages/com.unity.inputsystem/InputSystem/Editor/InputSystemPluginControl.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ private static void CheckForExtension()
4343
#if UNITY_2023_3_OR_NEWER
4444
BuildTarget.VisionOS,
4545
#endif
46-
#if UNITY_6000_0_OR_NEWER
47-
BuildTarget.ReservedCFE,
48-
#endif
49-
#if UNITY_6000_0_7_OR_NEWER
50-
BuildTarget.Kepler
51-
#endif
5246
BuildTarget.NoTarget
5347
};
5448

Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputControlPathDrawer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
4444
}
4545

4646
EditorGUI.BeginProperty(position, label, property);
47-
m_Editor.OnGUI(position, label, property, () => property.serializedObject.ApplyModifiedProperties());
47+
m_Editor.OnGUI(position, label, property: null, modifiedCallback: () => property.serializedObject.ApplyModifiedProperties());
4848
EditorGUI.EndProperty();
4949
}
5050
}

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/PackageResources/InputActionsEditor.uxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</uie:Toolbar>
1818
</ui:VisualElement>
1919
<ui:VisualElement name="body" style="flex-direction: column; flex-grow: 1;">
20-
<ui:TwoPaneSplitView name="actions-split-view" fixed-pane-initial-dimension="200">
20+
<ui:TwoPaneSplitView name="actions-split-view" fixed-pane-initial-dimension="200" view-data-key="actions-editor-splitter-1">
2121
<ui:VisualElement name="action-maps-container" class="body-panel-container actions-container">
2222
<ui:VisualElement name="header" class="body-panel-header">
2323
<ui:Label text="Action Maps" display-tooltip-when-elided="true" style="flex-grow: 1;" />
@@ -28,7 +28,7 @@
2828
</ui:VisualElement>
2929
<ui:VisualElement name="rclick-area-to-add-new-action-map" style="flex-direction: column; flex-grow: 1;" />
3030
</ui:VisualElement>
31-
<ui:TwoPaneSplitView name="actions-and-properties-split-view" fixed-pane-index="1" fixed-pane-initial-dimension="320" style="height: auto; min-width: 450px;">
31+
<ui:TwoPaneSplitView name="actions-and-properties-split-view" fixed-pane-index="1" fixed-pane-initial-dimension="320" style="height: auto; min-width: 450px;" view-data-key="actions-editor-splitter-2">
3232
<ui:VisualElement name="actions-container" class="body-panel-container">
3333
<ui:VisualElement name="header" class="body-panel-header" style="justify-content: space-between;">
3434
<ui:Label text="Actions" display-tooltip-when-elided="true" name="actions-label" />

Packages/com.unity.inputsystem/InputSystem/Plugins/UI/ExtendedAxisEventData.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@
33

44
namespace UnityEngine.InputSystem.UI
55
{
6-
// AxisEventData has no ToString. But that's the only thing we add so keeping
7-
// it internal.
8-
internal class ExtendedAxisEventData : AxisEventData
6+
// AxisEventData has no ToString. Also added device info. Keeping
7+
// it internal for now.
8+
internal class ExtendedAxisEventData : AxisEventData, INavigationEventData
99
{
10+
/// <summary>
11+
/// The <see cref="InputDevice"/> that generated the axis input.
12+
/// </summary>
13+
/// <seealso cref="Keyboard"/>
14+
/// <seealso cref="Gamepad"/>
15+
public InputDevice device { get; set; }
16+
1017
public ExtendedAxisEventData(EventSystem eventSystem)
1118
: base(eventSystem)
1219
{
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#if PACKAGE_DOCS_GENERATION || UNITY_INPUT_SYSTEM_ENABLE_UI
2+
using UnityEngine.EventSystems;
3+
4+
namespace UnityEngine.InputSystem.UI
5+
{
6+
// A BaseEventData with added device info.
7+
internal class ExtendedSubmitCancelEventData : BaseEventData, INavigationEventData
8+
{
9+
/// <summary>
10+
/// The <see cref="InputDevice"/> that generated the axis input.
11+
/// </summary>
12+
public InputDevice device { get; set; }
13+
14+
public ExtendedSubmitCancelEventData(EventSystem eventSystem)
15+
: base(eventSystem)
16+
{
17+
}
18+
}
19+
}
20+
#endif

0 commit comments

Comments
 (0)