Skip to content

Commit dc9452a

Browse files
authored
Merge branch 'develop' into isxb-1482/fix-custom-processor-serializesbyIndex
2 parents a349aa5 + e399779 commit dc9452a

17 files changed

+130
-28
lines changed

Assets/Tests/InputSystem.Editor/ProjectWideInputActionsEditorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public void Report(string message)
236236
}
237237
}
238238

239-
[Test(Description = "Verifies that the default asset do not generate any verification errors (Regardless of existing requirements)")]
239+
[Test(Description = "Verifies that the default asset does not generate any verification errors (Regardless of existing requirements)")]
240240
[Category(kTestCategory)]
241241
public void ProjectWideActions_ShouldSupportAssetVerification_AndHaveNoVerificationErrorsForDefaultAsset()
242242
{

Assets/Tests/InputSystem/Plugins/UITests.InputModuleTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,23 @@ public IEnumerator PointerExitChildShouldFullyExit()
157157
Assert.IsTrue(callbackCheck.pointerData.fullyExited == true);
158158
}
159159

160+
[UnityTest]
161+
[Description("Regression test for https://jira.unity3d.com/browse/ISXB-1493")]
162+
public IEnumerator DisablingDoesNotResetUserActions()
163+
{
164+
var actions = new DefaultInputActions();
165+
m_InputModule.actionsAsset = actions.asset;
166+
m_InputModule.cancel = InputActionReference.Create(actions.UI.Cancel);
167+
168+
m_InputModule.enabled = false;
169+
170+
yield return null;
171+
172+
Assert.IsNotNull(m_InputModule.cancel, "Disabling component shouldn't lose its data.");
173+
174+
actions.Dispose();
175+
}
176+
160177
public class PointerExitCallbackCheck : MonoBehaviour, IPointerExitHandler
161178
{
162179
public PointerEventData pointerData { get; private set; }

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ however, it has to be formatted properly to pass verification tests.
2828
- Fixed Gamepad stick up/down inputs that were not recognized in WebGL. [ISXB-1090](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1090)
2929
- Fixed reenabling the VirtualMouseInput component may sometimes lead to NullReferenceException. [ISXB-1096](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1096)
3030
- Fixed the default button press point not being respected in Editor (as well as some other Touchscreen properties). [ISXB-1152](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1152)
31+
- Fixed the TreeView compilation warnings when used with Unity 6.2 beta (ISX-2320)
32+
- Fixed actions being reset when disabling the InputSystemUIInputModule component [ISXB-1493](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1493)
33+
- Fixed a memory leak when disabling and enabling the InputSystemUIInputModule component at runtime [ISXB-1573](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1573)
3134
- Fixed PlayerInput component automatically switching away from the default ActionMap set to 'None'.
3235
- Fixed a console error being shown when targeting visionOS builds in 2022.3.
3336
- Fixed a Tap Interaction issue with analog controls. The Tap interaction would keep re-starting after timeout. [ISXB-627](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-627)

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
using UnityEditor.PackageManager.UI;
1010
using UnityEditor.ShortcutManagement;
1111

12+
#if UNITY_6000_2_OR_NEWER
13+
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
14+
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
15+
#endif
16+
1217
////TODO: Add "Revert" button
1318

1419
////TODO: add helpers to very quickly set up certain common configs (e.g. "FPS Controls" in add-action context menu;
@@ -245,7 +250,7 @@ private void SetAsset(InputActionAsset asset)
245250
if (asset == null)
246251
return;
247252

248-
m_ActionAssetManager = new InputActionAssetManager(asset) {onDirtyChanged = OnDirtyChanged};
253+
m_ActionAssetManager = new InputActionAssetManager(asset) { onDirtyChanged = OnDirtyChanged };
249254
//m_ActionAssetManager.Initialize(); // TODO No longer needed when using constructor
250255

251256
InitializeTrees();
@@ -515,7 +520,7 @@ private void LoadPropertiesForSelection()
515520
if (m_Toolbar.selectedDeviceRequirement != null)
516521
{
517522
// Single device selected from set of devices in control scheme.
518-
controlPathsToMatch = new[] {m_Toolbar.selectedDeviceRequirement.Value.controlPath};
523+
controlPathsToMatch = new[] { m_Toolbar.selectedDeviceRequirement.Value.controlPath };
519524
}
520525
else if (m_Toolbar.selectedControlScheme != null)
521526
{
@@ -581,14 +586,14 @@ private void ApplyAndReloadTrees()
581586
LoadPropertiesForSelection();
582587
}
583588

584-
#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST
589+
#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST
585590
private void OnLostFocus()
586591
{
587592
if (InputEditorUserSettings.autoSaveInputActionAssets)
588593
m_ActionAssetManager.SaveChangesToAsset();
589594
}
590595

591-
#endif
596+
#endif
592597

593598
private void Apply()
594599
{
@@ -598,11 +603,11 @@ private void Apply()
598603
m_ActionMapsTree.UpdateSerializedObjectDirtyCount();
599604
m_ActionsTree.UpdateSerializedObjectDirtyCount();
600605

601-
#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST
606+
#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST
602607
// If auto-save should be triggered on focus lost, only mark asset as dirty
603608
m_ActionAssetManager.MarkDirty();
604609
titleContent = m_DirtyTitle;
605-
#else
610+
#else
606611
// If auto-save is active, immediately flush out the changes to disk. Otherwise just
607612
// put us into dirty state.
608613
if (InputEditorUserSettings.autoSaveInputActionAssets)
@@ -614,7 +619,7 @@ private void Apply()
614619
m_ActionAssetManager.MarkDirty();
615620
titleContent = m_DirtyTitle;
616621
}
617-
#endif
622+
#endif
618623
}
619624

620625
private void OnGUI()

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionTreeView.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
using UnityEngine.InputSystem.Layouts;
1111
using UnityEngine.InputSystem.Utilities;
1212

13+
#if UNITY_6000_2_OR_NEWER
14+
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
15+
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
16+
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
17+
#endif
18+
1319
// The action tree view illustrates one of the weaknesses of Unity's editing model. While operating directly
1420
// on serialized data does have a number of advantages (the built-in undo system being one of them), making the
1521
// persistence model equivalent to the edit model doesn't work well. Serialized data will be laid out for persistence,
@@ -90,15 +96,15 @@ public static TreeViewItem BuildWithJustActionsAndBindingsFromMap(SerializedProp
9096
public static TreeViewItem BuildWithJustActionMapsFromAsset(SerializedObject assetObject)
9197
{
9298
Debug.Assert(assetObject != null, "Asset object cannot be null");
93-
var root = new ActionMapListItem {id = 0, depth = -1};
99+
var root = new ActionMapListItem { id = 0, depth = -1 };
94100
ActionMapTreeItem.AddActionMapsFromAssetTo(root, assetObject);
95101
return root;
96102
}
97103

98104
public static TreeViewItem BuildFullTree(SerializedObject assetObject)
99105
{
100106
Debug.Assert(assetObject != null, "Asset object cannot be null");
101-
var root = new TreeViewItem {id = 0, depth = -1};
107+
var root = new TreeViewItem { id = 0, depth = -1 };
102108
ActionMapTreeItem.AddActionMapsFromAssetTo(root, assetObject);
103109
if (root.hasChildren)
104110
foreach (var child in root.children)
@@ -368,7 +374,7 @@ public IEnumerable<TItem> GetSelectedItemsOrParentsOfType<TItem>()
368374
public void SelectFirstToplevelItem()
369375
{
370376
if (rootItem.children.Any())
371-
SetSelection(new[] {rootItem.children[0].id}, TreeViewSelectionOptions.FireSelectionChanged);
377+
SetSelection(new[] { rootItem.children[0].id }, TreeViewSelectionOptions.FireSelectionChanged);
372378
}
373379

374380
protected override void SelectionChanged(IList<int> selectedIds)
@@ -739,7 +745,7 @@ public void PasteItems(string copyBufferString, IEnumerable<InsertLocation> loca
739745
// Split buffer into transmissions and then into transmission blocks. Each transmission is an item subtree
740746
// meant to be pasted as a whole and each transmission block is a single chunk of serialized data.
741747
foreach (var transmission in copyBufferString.Substring(k_CopyPasteMarker.Length)
742-
.Split(new[] {k_EndOfTransmission}, StringSplitOptions.RemoveEmptyEntries))
748+
.Split(new[] { k_EndOfTransmission }, StringSplitOptions.RemoveEmptyEntries))
743749
{
744750
foreach (var location in locations)
745751
PasteBlocks(transmission, location, assignNewIDs, newItemPropertyPaths);
@@ -768,7 +774,7 @@ private void PasteBlocks(string transmission, InsertLocation location, bool assi
768774
{
769775
Debug.Assert(location.item != null, "Should have drop target");
770776

771-
var blocks = transmission.Split(new[] {k_EndOfTransmissionBlock},
777+
var blocks = transmission.Split(new[] { k_EndOfTransmissionBlock },
772778
StringSplitOptions.RemoveEmptyEntries);
773779
if (blocks.Length < 1)
774780
return;
@@ -1630,17 +1636,17 @@ private bool CheckChildrenFor(Match match, ActionTreeItemBase item)
16301636

16311637
public static FilterCriterion ByName(string name)
16321638
{
1633-
return new FilterCriterion {text = name, type = Type.ByName};
1639+
return new FilterCriterion { text = name, type = Type.ByName };
16341640
}
16351641

16361642
public static FilterCriterion ByBindingGroup(string group)
16371643
{
1638-
return new FilterCriterion {text = group, type = Type.ByBindingGroup};
1644+
return new FilterCriterion { text = group, type = Type.ByBindingGroup };
16391645
}
16401646

16411647
public static FilterCriterion ByDeviceLayout(string layout)
16421648
{
1643-
return new FilterCriterion {text = layout, type = Type.ByDeviceLayout};
1649+
return new FilterCriterion { text = layout, type = Type.ByDeviceLayout };
16441650
}
16451651

16461652
public static List<FilterCriterion> FromString(string criteria)

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionTreeViewItems.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
using UnityEditor.IMGUI.Controls;
77
using UnityEngine.InputSystem.Utilities;
88

9+
#if UNITY_6000_2_OR_NEWER
10+
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
11+
#endif
12+
913
////TODO: sync expanded state of SerializedProperties to expanded state of tree (will help preserving expansion in inspector)
1014

1115
////REVIEW: would be great to align all "[device]" parts of binding strings neatly in a column

Packages/com.unity.inputsystem/InputSystem/Editor/Debugger/InputDebuggerWindow.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
using UnityEngine.InputSystem.Users;
1313
using UnityEngine.InputSystem.Utilities;
1414

15+
#if UNITY_6000_2_OR_NEWER
16+
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
17+
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
18+
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
19+
#endif
20+
1521
////FIXME: Generate proper IDs for the individual tree view items; the current sequential numbering scheme just causes lots of
1622
//// weird expansion/collapsing to happen.
1723

@@ -275,7 +281,8 @@ private static void DrawConnectionGUI()
275281
var profilerName = ProfilerDriver.GetConnectionIdentifier(profiler);
276282
var isConnected = ProfilerDriver.connectedProfiler == profiler;
277283
if (enabled)
278-
menu.AddItem(new GUIContent(profilerName), isConnected, () => {
284+
menu.AddItem(new GUIContent(profilerName), isConnected, () =>
285+
{
279286
ProfilerDriver.connectedProfiler = profiler;
280287
EnableRemoteDevices();
281288
});
@@ -291,7 +298,8 @@ private static void DrawConnectionGUI()
291298

292299
var url = "device://" + device.id;
293300
var isConnected = ProfilerDriver.connectedProfiler == 0xFEEE && ProfilerDriver.directConnectionUrl == url;
294-
menu.AddItem(new GUIContent(device.name), isConnected, () => {
301+
menu.AddItem(new GUIContent(device.name), isConnected, () =>
302+
{
295303
ProfilerDriver.DirectURLConnect(url);
296304
EnableRemoteDevices();
297305
});
@@ -961,7 +969,7 @@ private unsafe void AddActionItem(TreeViewItem parent, InputAction action, ref i
961969
{
962970
var control = state.controls[controlStartIndex + n];
963971
var interactions =
964-
StringHelpers.Join(new[] {binding.effectiveInteractions, action.interactions}, ",");
972+
StringHelpers.Join(new[] { binding.effectiveInteractions, action.interactions }, ",");
965973

966974
var text = control.path;
967975
if (!string.IsNullOrEmpty(interactions))

Packages/com.unity.inputsystem/InputSystem/Editor/Debugger/InputDeviceDebuggerWindow.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
using UnityEngine.InputSystem.LowLevel;
1010
using UnityEngine.InputSystem.Utilities;
1111

12+
#if UNITY_6000_2_OR_NEWER
13+
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
14+
#endif
15+
1216
////TODO: allow selecting events and saving out only the selected ones
1317

1418
////TODO: add the ability for the debugger to just generate input on the device according to the controls it finds; good for testing

Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputControlTreeView.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
using UnityEngine.InputSystem.LowLevel;
77
using Unity.Profiling;
88

9+
#if UNITY_6000_2_OR_NEWER
10+
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
11+
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
12+
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
13+
#endif
14+
915
////TODO: make control values editable (create state events from UI and pump them into the system)
1016

1117
////TODO: show processors attached to controls
@@ -99,20 +105,20 @@ private static MultiColumnHeaderState CreateHeaderState(int numValueColumns)
99105
headerContent = new GUIContent("Type")
100106
};
101107
columns[(int)ColumnId.Format] =
102-
new MultiColumnHeaderState.Column {headerContent = new GUIContent("Format")};
108+
new MultiColumnHeaderState.Column { headerContent = new GUIContent("Format") };
103109
columns[(int)ColumnId.Offset] =
104-
new MultiColumnHeaderState.Column {headerContent = new GUIContent("Offset")};
110+
new MultiColumnHeaderState.Column { headerContent = new GUIContent("Offset") };
105111
columns[(int)ColumnId.Bit] =
106-
new MultiColumnHeaderState.Column {width = 40, headerContent = new GUIContent("Bit")};
112+
new MultiColumnHeaderState.Column { width = 40, headerContent = new GUIContent("Bit") };
107113
columns[(int)ColumnId.Size] =
108-
new MultiColumnHeaderState.Column {headerContent = new GUIContent("Size (Bits)")};
114+
new MultiColumnHeaderState.Column { headerContent = new GUIContent("Size (Bits)") };
109115
columns[(int)ColumnId.Optimized] =
110-
new MultiColumnHeaderState.Column {headerContent = new GUIContent("Optimized")};
116+
new MultiColumnHeaderState.Column { headerContent = new GUIContent("Optimized") };
111117

112118
if (numValueColumns == 1)
113119
{
114120
columns[(int)ColumnId.Value] =
115-
new MultiColumnHeaderState.Column {width = 120, headerContent = new GUIContent("Value")};
121+
new MultiColumnHeaderState.Column { width = 120, headerContent = new GUIContent("Value") };
116122
}
117123
else
118124
{
@@ -151,7 +157,7 @@ protected override TreeViewItem BuildRoot()
151157
return new TreeViewItem
152158
{
153159
id = 0,
154-
children = new List<TreeViewItem> {rootItem},
160+
children = new List<TreeViewItem> { rootItem },
155161
depth = -1
156162
};
157163
}

Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputEventTreeView.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
using UnityEditor;
77
using Unity.Profiling;
88

9+
#if UNITY_6000_2_OR_NEWER
10+
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
11+
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
12+
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
13+
#endif
14+
915
////FIXME: this performs horribly; the constant rebuilding on every single event makes the debug view super slow when device is noisy
1016

1117
////TODO: add information about which update type + update count an event came through in
@@ -271,7 +277,7 @@ private unsafe void ColumnGUI(Rect cellRect, InputEventPtr eventPtr, int column)
271277
else if (eventPtr.IsA<TextEvent>())
272278
{
273279
var textEventPtr = TextEvent.From(eventPtr);
274-
GUI.Label(cellRect, $"Character='{(char) textEventPtr->character}'");
280+
GUI.Label(cellRect, $"Character='{(char)textEventPtr->character}'");
275281
}
276282
break;
277283
}

0 commit comments

Comments
 (0)