From d0eafd3ce13ea3426a88d64ae76bd25c65766972 Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Fri, 20 Feb 2026 16:07:33 +0100 Subject: [PATCH 1/4] Update UITests.cs --- Assets/Tests/InputSystem/Plugins/UITests.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Assets/Tests/InputSystem/Plugins/UITests.cs b/Assets/Tests/InputSystem/Plugins/UITests.cs index fe077139b0..ae54aa6734 100644 --- a/Assets/Tests/InputSystem/Plugins/UITests.cs +++ b/Assets/Tests/InputSystem/Plugins/UITests.cs @@ -31,9 +31,7 @@ using UnityEditor.SceneManagement; #endif -#if UNITY_2021_2_OR_NEWER using UnityEngine.UIElements; -#endif #pragma warning disable CS0649 ////TODO: app focus handling @@ -852,7 +850,6 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p // press positions on the moves will be zero. // PointerMove. -#if UNITY_2021_2_OR_NEWER OneEvent("type", EventType.PointerMove), OneEvent("button", PointerEventData.InputButton.Left), OneEvent("pointerEnter", scene.leftGameObject), @@ -867,7 +864,6 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p OneEvent("dragging", clickButton == PointerEventData.InputButton.Left ? true : false), OneEvent("pointerPressRaycast.gameObject", clickButton == PointerEventData.InputButton.Left ? scene.leftGameObject : null), OneEvent("pointerPressRaycast.screenPosition", clickButton == PointerEventData.InputButton.Left ? firstScreenPosition : Vector2.zero), -#endif // PointerExit. OneEvent("type", EventType.PointerExit), @@ -1892,7 +1888,6 @@ public IEnumerator UI_CanReleaseAndPressTouchesOnSameFrame() .Matches((UICallbackReceiver.Event e) => e.pointerData.pointerType == UIPointerType.Touch).And .Matches((UICallbackReceiver.Event e) => e.pointerData.position == secondPosition)); -#if UNITY_2021_2_OR_NEWER Assert.That(scene.rightChildReceiver.events, Has.Exactly(1).With.Property("type").EqualTo(EventType.PointerMove).And .Matches((UICallbackReceiver.Event e) => e.pointerData.device == touchScreen).And @@ -1900,7 +1895,6 @@ public IEnumerator UI_CanReleaseAndPressTouchesOnSameFrame() .Matches((UICallbackReceiver.Event e) => e.pointerData.pointerId == pointerIdTouch2).And .Matches((UICallbackReceiver.Event e) => e.pointerData.pointerType == UIPointerType.Touch).And .Matches((UICallbackReceiver.Event e) => e.pointerData.position == secondPosition)); -#endif // Pointer 3 Assert.That(scene.rightChildReceiver.events, @@ -2149,10 +2143,8 @@ public IEnumerator UI_CanDriveUIFromMultipleTrackedDevices() AllEvents("pointerId", trackedDevice1.deviceId), AllEvents("device", trackedDevice1), AllEvents("trackedDeviceOrientation", scene.GetLookAtQuaternion(Vector3.zero, scene.leftGameObject)), - OneEvent("type", EventType.PointerEnter) -#if UNITY_2021_2_OR_NEWER - , OneEvent("type", EventType.PointerMove) -#endif + OneEvent("type", EventType.PointerEnter), + OneEvent("type", EventType.PointerMove) ) ); Assert.That(scene.rightChildReceiver.events, Is.Empty); @@ -2170,7 +2162,6 @@ public IEnumerator UI_CanDriveUIFromMultipleTrackedDevices() AllEvents("device", trackedDevice2), AllEvents("trackedDeviceOrientation", scene.GetLookAtQuaternion(Vector3.zero, scene.leftGameObject, Vector3.left)), OneEvent("type", EventType.PointerEnter) -#if UNITY_2021_2_OR_NEWER , OneEvent("type", EventType.PointerMove) #endif ) From 6ec6d34458faf85a88b105e9b397ccfa688a4e64 Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Fri, 20 Feb 2026 16:08:04 +0100 Subject: [PATCH 2/4] Update UITests.cs --- Assets/Tests/InputSystem/Plugins/UITests.cs | 82 +++++---------------- 1 file changed, 17 insertions(+), 65 deletions(-) diff --git a/Assets/Tests/InputSystem/Plugins/UITests.cs b/Assets/Tests/InputSystem/Plugins/UITests.cs index ae54aa6734..a09b12aafe 100644 --- a/Assets/Tests/InputSystem/Plugins/UITests.cs +++ b/Assets/Tests/InputSystem/Plugins/UITests.cs @@ -397,13 +397,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p } yield return null; - const int kHaveMovementEvents = -#if UNITY_2021_2_OR_NEWER - 1 -#else - 0 -#endif - ; + const int kHaveMovementEvents = 1; Assert.That(scene.leftChildReceiver.events, Has.Count.EqualTo((isTouch ? 3 : 1) + kHaveMovementEvents)); Assert.That(scene.parentReceiver.events, Has.Count.EqualTo(1 + kHaveMovementEvents)); @@ -484,7 +478,6 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p // Touch has no ability to point without pressing so pointer enter event is followed // right by pointer down event. -#if UNITY_2021_2_OR_NEWER // PointerMove. Assert.That(scene.leftChildReceiver.events[0 + kHaveMovementEvents].type, Is.EqualTo(EventType.PointerMove)); Assert.That(scene.leftChildReceiver.events[0 + kHaveMovementEvents].pointerData.button, Is.EqualTo(PointerEventData.InputButton.Left)); @@ -512,7 +505,6 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p Assert.That(scene.leftChildReceiver.events[0 + kHaveMovementEvents].pointerData.pointerPressRaycast.gameObject, Is.Null); Assert.That(scene.leftChildReceiver.events[0 + kHaveMovementEvents].pointerData.pointerPressRaycast.screenPosition, Is.EqualTo(default(Vector2)).Using(Vector2EqualityComparer.Instance)); -#endif // PointerDown. Assert.That(scene.leftChildReceiver.events[1 + kHaveMovementEvents].type, Is.EqualTo(EventType.PointerDown)); @@ -739,7 +731,6 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p AllEvents("pointerCurrentRaycast.screenPosition", secondScreenPosition), // PointerMove. -#if UNITY_2021_2_OR_NEWER OneEvent("type", EventType.PointerMove), OneEvent("dragging", false), // Again, pointer movement is processed exclusively "from" the left button. @@ -753,7 +744,6 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p OneEvent("lastPress", clickButton == PointerEventData.InputButton.Left ? null : scene.leftGameObject), OneEvent("pointerPressRaycast.gameObject", clickButton == PointerEventData.InputButton.Left ? scene.leftGameObject : null), OneEvent("pointerPressRaycast.screenPosition", clickButton == PointerEventData.InputButton.Left ? firstScreenPosition : Vector2.zero), -#endif // BeginDrag. OneEvent("type", EventType.BeginDrag), @@ -786,12 +776,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p ); Assert.That(scene.rightChildReceiver.events, Is.Empty); - Assert.That(scene.parentReceiver.events, - EventSequence( -#if UNITY_2021_2_OR_NEWER - OneEvent("type", EventType.PointerMove) -#endif - ) + Assert.That(scene.parentReceiver.events, EventSequence(OneEvent("type", EventType.PointerMove)) ); scene.leftChildReceiver.events.Clear(); @@ -817,12 +802,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p Assert.That(scene.eventSystem.IsPointerOverGameObject(pointerId), Is.True); // Should not have seen pointer enter/exit on parent (we only moved from one of its // children to another) but *should* have seen a move event. - Assert.That(scene.parentReceiver.events, - EventSequence( -#if UNITY_2021_2_OR_NEWER - OneEvent("type", EventType.PointerMove) -#endif - ) + Assert.That(scene.parentReceiver.events, EventSequence(OneEvent("type", EventType.PointerMove)) ); if (isTracked) @@ -923,10 +903,8 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p AllEvents("pointerPressRaycast.gameObject", clickButton == PointerEventData.InputButton.Left ? scene.leftGameObject : null), AllEvents("pointerPressRaycast.screenPosition", clickButton == PointerEventData.InputButton.Left ? firstScreenPosition : Vector2.zero), - OneEvent("type", EventType.PointerEnter) -#if UNITY_2021_2_OR_NEWER - , OneEvent("type", EventType.PointerMove) -#endif + OneEvent("type", EventType.PointerEnter), + OneEvent("type", EventType.PointerMove) ) ); @@ -2019,12 +1997,10 @@ public IEnumerator UI_CanUseTouchSimulationWithUI() AllEvents("pointerType", UIPointerType.Touch), AllEvents("touchId", 1), AllEvents("position", scene.From640x480ToScreen(180, 180)), - OneEvent("type", EventType.PointerEnter) -#if UNITY_2021_2_OR_NEWER - , OneEvent("type", EventType.PointerMove) -#endif - , OneEvent("type", EventType.PointerDown) - , OneEvent("type", EventType.InitializePotentialDrag) + OneEvent("type", EventType.PointerEnter), + OneEvent("type", EventType.PointerMove), + OneEvent("type", EventType.PointerDown), + OneEvent("type", EventType.InitializePotentialDrag) ) ); @@ -2161,9 +2137,8 @@ public IEnumerator UI_CanDriveUIFromMultipleTrackedDevices() AllEvents("pointerId", trackedDevice2.deviceId), AllEvents("device", trackedDevice2), AllEvents("trackedDeviceOrientation", scene.GetLookAtQuaternion(Vector3.zero, scene.leftGameObject, Vector3.left)), - OneEvent("type", EventType.PointerEnter) - , OneEvent("type", EventType.PointerMove) -#endif + OneEvent("type", EventType.PointerEnter), + OneEvent("type", EventType.PointerMove) ) ); Assert.That(scene.rightChildReceiver.events, Is.Empty); @@ -2221,9 +2196,7 @@ public IEnumerator UI_CanDriveUIFromMultipleTrackedDevices() AllEvents("pointerId", trackedDevice1.deviceId), AllEvents("device", trackedDevice1), AllEvents("trackedDeviceOrientation", scene.GetLookAtQuaternion(Vector3.zero, scene.rightGameObject)), -#if UNITY_2021_2_OR_NEWER OneEvent("type", EventType.PointerMove), -#endif OneEvent("type", EventType.PointerExit) ) ); @@ -2233,10 +2206,8 @@ public IEnumerator UI_CanDriveUIFromMultipleTrackedDevices() AllEvents("pointerId", trackedDevice1.deviceId), AllEvents("device", trackedDevice1), AllEvents("trackedDeviceOrientation", scene.GetLookAtQuaternion(Vector3.zero, scene.rightGameObject)), - OneEvent("type", EventType.PointerEnter) -#if UNITY_2021_2_OR_NEWER - , OneEvent("type", EventType.PointerMove) -#endif + OneEvent("type", EventType.PointerEnter), + OneEvent("type", EventType.PointerMove) ) ); @@ -2253,9 +2224,7 @@ public IEnumerator UI_CanDriveUIFromMultipleTrackedDevices() AllEvents("pointerId", trackedDevice2.deviceId), AllEvents("device", trackedDevice2), AllEvents("trackedDeviceOrientation", scene.GetLookAtQuaternion(Vector3.zero, scene.rightGameObject, Vector3.right)), -#if UNITY_2021_2_OR_NEWER OneEvent("type", EventType.PointerMove), -#endif OneEvent("type", EventType.PointerExit) ) ); @@ -2266,9 +2235,7 @@ public IEnumerator UI_CanDriveUIFromMultipleTrackedDevices() AllEvents("device", trackedDevice2), AllEvents("trackedDeviceOrientation", scene.GetLookAtQuaternion(Vector3.zero, scene.rightGameObject, Vector3.right)), OneEvent("type", EventType.PointerEnter) -#if UNITY_2021_2_OR_NEWER , OneEvent("type", EventType.PointerMove) -#endif ) ); } @@ -2591,13 +2558,8 @@ public IEnumerator UI_CanGetRaycastResultMatchingEvent() var raycastResult = scene.uiModule.GetLastRaycastResult(trackedDevice.deviceId); Assert.That(raycastResult.isValid, Is.True); - - //2021.2 added an additional move event. -#if UNITY_2021_2_OR_NEWER + Assert.That(scene.leftChildReceiver.events, Has.Count.EqualTo(2)); -#else - Assert.That(scene.leftChildReceiver.events, Has.Count.EqualTo(1)); -#endif Assert.That(scene.leftChildReceiver.events[0].pointerData, Is.Not.Null); var eventRaycastResult = scene.leftChildReceiver.events[0].pointerData.pointerCurrentRaycast; @@ -4162,9 +4124,7 @@ public IEnumerator UI_WhenAppLosesAndRegainsFocus_WhileUIButtonIsPressed_UIButto Assert.That(scene.leftChildReceiver.events, EventSequence( OneEvent("type", EventType.PointerEnter), -#if UNITY_2021_2_OR_NEWER OneEvent("type", EventType.PointerMove), -#endif OneEvent("type", EventType.PointerDown), OneEvent("type", EventType.InitializePotentialDrag) ) @@ -4627,9 +4587,7 @@ private enum EventType PointerUp, PointerEnter, PointerExit, -#if UNITY_2021_2_OR_NEWER PointerMove, -#endif Select, Deselect, InitializePotentialDrag, @@ -4644,11 +4602,8 @@ private enum EventType } private class UICallbackReceiver : MonoBehaviour, IPointerClickHandler, IPointerDownHandler, IPointerEnterHandler, -#if UNITY_2021_2_OR_NEWER - IPointerMoveHandler, -#endif - IPointerExitHandler, IPointerUpHandler, IMoveHandler, ISelectHandler, IDeselectHandler, IInitializePotentialDragHandler, - IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler, ISubmitHandler, ICancelHandler, IScrollHandler + IPointerMoveHandler, IPointerExitHandler, IPointerUpHandler, IMoveHandler, ISelectHandler, IDeselectHandler, + IInitializePotentialDragHandler, IBeginDragHandler, IDragHandler, IEndDragHandler, IDropHandler, ISubmitHandler, ICancelHandler, IScrollHandler { public struct Event { @@ -4700,14 +4655,11 @@ public void OnPointerUp(PointerEventData eventData) events.Add(new Event(EventType.PointerUp, ClonePointerEventData(eventData))); } -#if UNITY_2021_2_OR_NEWER public void OnPointerMove(PointerEventData eventData) { events.Add(new Event(EventType.PointerMove, ClonePointerEventData(eventData))); } - -#endif - + public void OnMove(AxisEventData eventData) { events.Add(new Event(EventType.Move, CloneAxisEventData(eventData))); From ff3c90bc7253cf945fd7b486a153d10497a756d3 Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Fri, 20 Feb 2026 16:13:32 +0100 Subject: [PATCH 3/4] Remove old mentions of EDITOR_2021 --- Assets/Tests/InputSystem/Plugins/DeviceSimulatorTests.cs | 2 +- Assets/Tests/InputSystem/Plugins/UITests.cs | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Assets/Tests/InputSystem/Plugins/DeviceSimulatorTests.cs b/Assets/Tests/InputSystem/Plugins/DeviceSimulatorTests.cs index b2254be877..7a513aa16b 100644 --- a/Assets/Tests/InputSystem/Plugins/DeviceSimulatorTests.cs +++ b/Assets/Tests/InputSystem/Plugins/DeviceSimulatorTests.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_2021_1_OR_NEWER +#if UNITY_EDITOR using System.Collections; using System.Reflection; diff --git a/Assets/Tests/InputSystem/Plugins/UITests.cs b/Assets/Tests/InputSystem/Plugins/UITests.cs index a09b12aafe..1eef689257 100644 --- a/Assets/Tests/InputSystem/Plugins/UITests.cs +++ b/Assets/Tests/InputSystem/Plugins/UITests.cs @@ -3994,9 +3994,7 @@ public IEnumerator UI_CanOperateUIToolkitInterface_UsingInputSystemUIInputModule ////FIXME: as of a time of writing, this line is broken on trunk due to the bug in UITK // The bug is https://fogbugz.unity3d.com/f/cases/1323488/ // just adding a define as a safeguard measure to reenable it when trunk goes to next version cycle -#if UNITY_2021_3_OR_NEWER Assert.That(scrollView.verticalScroller.value, Is.GreaterThan(0)); -#endif // Try a button press with the gamepad. // NOTE: The current version of UITK does not focus the button automatically. Fix for that is in the pipe. @@ -4767,7 +4765,6 @@ private static ExtendedPointerEventData ClonePointerEventData(PointerEventData e pointerType = extendedEventData.pointerType, trackedDeviceOrientation = extendedEventData.trackedDeviceOrientation, trackedDevicePosition = extendedEventData.trackedDevicePosition, -#if UNITY_2021_1_OR_NEWER pressure = eventData.pressure, tangentialPressure = eventData.tangentialPressure, altitudeAngle = eventData.altitudeAngle, @@ -4775,7 +4772,6 @@ private static ExtendedPointerEventData ClonePointerEventData(PointerEventData e twist = eventData.twist, radius = eventData.radius, radiusVariance = eventData.radiusVariance, -#endif #if UNITY_2022_3_OR_NEWER displayIndex = eventData.displayIndex, #endif From 4e4f2673b627550fe0f32fa3d4068b1b26983667 Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Fri, 20 Feb 2026 16:25:52 +0100 Subject: [PATCH 4/4] Formatting file --- Assets/Tests/InputSystem/Plugins/UITests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/Tests/InputSystem/Plugins/UITests.cs b/Assets/Tests/InputSystem/Plugins/UITests.cs index 1eef689257..359eee0e71 100644 --- a/Assets/Tests/InputSystem/Plugins/UITests.cs +++ b/Assets/Tests/InputSystem/Plugins/UITests.cs @@ -903,7 +903,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p AllEvents("pointerPressRaycast.gameObject", clickButton == PointerEventData.InputButton.Left ? scene.leftGameObject : null), AllEvents("pointerPressRaycast.screenPosition", clickButton == PointerEventData.InputButton.Left ? firstScreenPosition : Vector2.zero), - OneEvent("type", EventType.PointerEnter), + OneEvent("type", EventType.PointerEnter), OneEvent("type", EventType.PointerMove) ) ); @@ -2558,7 +2558,7 @@ public IEnumerator UI_CanGetRaycastResultMatchingEvent() var raycastResult = scene.uiModule.GetLastRaycastResult(trackedDevice.deviceId); Assert.That(raycastResult.isValid, Is.True); - + Assert.That(scene.leftChildReceiver.events, Has.Count.EqualTo(2)); Assert.That(scene.leftChildReceiver.events[0].pointerData, Is.Not.Null); @@ -4657,7 +4657,7 @@ public void OnPointerMove(PointerEventData eventData) { events.Add(new Event(EventType.PointerMove, ClonePointerEventData(eventData))); } - + public void OnMove(AxisEventData eventData) { events.Add(new Event(EventType.Move, CloneAxisEventData(eventData)));