From ab1b38a7b88a23a72fa519f66ed2fd345d85b373 Mon Sep 17 00:00:00 2001 From: StefanUnity <40492087+stefanunity@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:40:43 +0100 Subject: [PATCH 01/82] Bump version to 1.8.0-pre.3 (#1796) --- .../InGameHints/InGameHintsActions.inputactions | 15 ++++++++++----- .../SimpleDemo/SimpleControls.inputactions | 9 ++++++--- Packages/com.unity.inputsystem/CHANGELOG.md | 2 ++ Packages/com.unity.inputsystem/package.json | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Assets/Samples/InGameHints/InGameHintsActions.inputactions b/Assets/Samples/InGameHints/InGameHintsActions.inputactions index 2fdea4cae2..13bd420d9c 100644 --- a/Assets/Samples/InGameHints/InGameHintsActions.inputactions +++ b/Assets/Samples/InGameHints/InGameHintsActions.inputactions @@ -11,7 +11,8 @@ "id": "7e7492e7-1329-48bb-9fdc-279fd15473b4", "expectedControlType": "Vector2", "processors": "", - "interactions": "" + "interactions": "", + "initialStateCheck": true }, { "name": "Look", @@ -19,7 +20,8 @@ "id": "981fecc2-2e7a-4d6a-b041-00b47626e0a1", "expectedControlType": "Vector2", "processors": "", - "interactions": "" + "interactions": "", + "initialStateCheck": true }, { "name": "PickUp", @@ -27,7 +29,8 @@ "id": "5a59bbc2-a3d4-4cbd-88bb-01120d97dc69", "expectedControlType": "", "processors": "", - "interactions": "" + "interactions": "", + "initialStateCheck": false }, { "name": "Drop", @@ -35,7 +38,8 @@ "id": "f37bbe7e-e241-443f-b868-c784e1219f25", "expectedControlType": "", "processors": "", - "interactions": "" + "interactions": "", + "initialStateCheck": false }, { "name": "Throw", @@ -43,7 +47,8 @@ "id": "e450d71c-7cc5-4879-afb5-f3ed682d9824", "expectedControlType": "", "processors": "", - "interactions": "" + "interactions": "", + "initialStateCheck": false } ], "bindings": [ diff --git a/Assets/Samples/SimpleDemo/SimpleControls.inputactions b/Assets/Samples/SimpleDemo/SimpleControls.inputactions index 15e9e5877a..18b9f71021 100644 --- a/Assets/Samples/SimpleDemo/SimpleControls.inputactions +++ b/Assets/Samples/SimpleDemo/SimpleControls.inputactions @@ -11,7 +11,8 @@ "id": "1077f913-a9f9-41b1-acb3-b9ee0adbc744", "expectedControlType": "Button", "processors": "", - "interactions": "Tap,SlowTap" + "interactions": "Tap,SlowTap", + "initialStateCheck": false }, { "name": "move", @@ -19,7 +20,8 @@ "id": "50fd2809-3aa3-4a90-988e-1facf6773553", "expectedControlType": "Vector2", "processors": "", - "interactions": "" + "interactions": "", + "initialStateCheck": true }, { "name": "look", @@ -27,7 +29,8 @@ "id": "c60e0974-d140-4597-a40e-9862193067e9", "expectedControlType": "Vector2", "processors": "", - "interactions": "" + "interactions": "", + "initialStateCheck": true } ], "bindings": [ diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index cf54e4ed9e..c9ca987a20 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. Due to package verification, the latest version below is the unpublished version and the date is meaningless. however, it has to be formatted properly to pass verification tests. +## [Unreleased] + ## [1.8.0-pre.2] - 2023-11-09 ### Changed diff --git a/Packages/com.unity.inputsystem/package.json b/Packages/com.unity.inputsystem/package.json index 961d94a107..47225204e3 100755 --- a/Packages/com.unity.inputsystem/package.json +++ b/Packages/com.unity.inputsystem/package.json @@ -1,7 +1,7 @@ { "name": "com.unity.inputsystem", "displayName": "Input System", - "version": "1.8.0-pre.2", + "version": "1.8.0-pre.3", "unity": "2019.4", "description": "A new input system which can be used as a more extensible and customizable alternative to Unity's classic input system in UnityEngine.Input.", "keywords": [ From f6109b81095a5a73c6a40c26e2960f4a9b5c590a Mon Sep 17 00:00:00 2001 From: Graham Huws <102745393+graham-huws@users.noreply.github.com> Date: Mon, 20 Nov 2023 11:27:26 +0000 Subject: [PATCH 02/82] FIX: Add missing confirmation popup when deleting a control scheme (ISX-1553). (#1798) * Fix missing confirmation when deleting a control scheme (ISX-1553). * Move changelog to Unreleased. --- Packages/com.unity.inputsystem/CHANGELOG.md | 4 +++- .../UITKAssetEditor/Commands/ControlSchemeCommands.cs | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index c9ca987a20..74c0c112ca 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -10,6 +10,9 @@ however, it has to be formatted properly to pass verification tests. ## [Unreleased] +### Fixed +- Fixed missing confirmation popup when deleting a control scheme. + ## [1.8.0-pre.2] - 2023-11-09 ### Changed @@ -50,7 +53,6 @@ however, it has to be formatted properly to pass verification tests. - Fixed issue with UI Toolkit based Input Action Editor not restoring it's selected items after Domain Reload. - Fixed the [`GetHapticCapabilitiesCommand`](xref:UnityEngine.InputSystem.XR.Haptics.GetHapticCapabilitiesCommand) always failing to execute due to a mismatch in the size in bytes of the payload and the size expected by XR devices. Changed [`HapticCapabilities`](xref:UnityEngine.InputSystem.XR.Haptics.HapticCapabilities) to include all properties returned by the XR input subsystem. This makes Input System match the functionality provided by the [XR](https://docs.unity3d.com/Manual/com.unity.modules.xr.html) module's [`InputDevice.TryGetHapticCapabilities`](https://docs.unity3d.com/ScriptReference/XR.InputDevice.TryGetHapticCapabilities.html) and [`HapticCapabilities`](https://docs.unity3d.com/ScriptReference/XR.HapticCapabilities.html). - ## [1.8.0-pre.1] - 2023-09-04 ### Added diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs index 4d7e87f5c1..9a492149bf 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs @@ -151,6 +151,12 @@ public static Command DeleteSelectedControlScheme() throw new InvalidOperationException("Control scheme doesn't exist in collection."); var indexOfArrayElement = serializedControlScheme.GetIndexOfArrayElement(); + + // Ask for confirmation. + if (!EditorUtility.DisplayDialog("Delete scheme?", + $"Do you want to delete control scheme '{selectedControlSchemeName}'?", "Delete", "Cancel")) + return state; + serializedArray.DeleteArrayElementAtIndex(indexOfArrayElement); state.serializedObject.ApplyModifiedProperties(); From 180bbdd62938e6fcb76a2a8a4961d747d53c9cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o?= Date: Wed, 22 Nov 2023 20:34:12 +0100 Subject: [PATCH 03/82] FIX: Make `DisableAndResetAllDevices` handle events while player runs in the background (#1797) * Make `DisableAndResetAllDevices` handle events Input events queued when the player runs in the background weren't being handled before, when setting the background behavior with `DisableAndResetAllDevices` option. This would result in A LOT of events needed to be processed once the player regained focus. Also,action callbacks could be invoked incorrectly depending on what events were queued in the background. * SQUASH Try fix editor test failure * Fix comments --- Assets/Tests/InputSystem/CoreTests_Devices.cs | 49 +++++++++++++++++++ .../InputSystem/InputManager.cs | 17 +++---- 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/Assets/Tests/InputSystem/CoreTests_Devices.cs b/Assets/Tests/InputSystem/CoreTests_Devices.cs index 8ce948bbf2..0408664175 100644 --- a/Assets/Tests/InputSystem/CoreTests_Devices.cs +++ b/Assets/Tests/InputSystem/CoreTests_Devices.cs @@ -5194,6 +5194,55 @@ void DeviceChangeCallback(InputDevice device, InputDeviceChange change) #pragma warning restore CS0162 } + [Test] + [Category("Devices")] + // This test validates that when InputSettings.BackgroundBehavior.ResetAndDisableAllDevices is selected, + // events are not available to process once the app regains focus. + // Essentially, only the relevant input events are processed. + public void Devices_CanSkipProcessingEventsWhileInBackground() + { + InputSystem.runInBackground = true; + InputSystem.settings.backgroundBehavior = InputSettings.BackgroundBehavior.ResetAndDisableAllDevices; + + var time = 0; + var gamepad = InputSystem.AddDevice(); + var pressAction = new InputAction("Press", binding: "/buttonSouth"); + var performedCount = 0; + + pressAction.performed += ctx => + { + performedCount++; + }; + pressAction.Enable(); + + InputSystem.Update(); + Assert.That(gamepad.canRunInBackground, Is.False); + + Press(gamepad.buttonSouth, time: time++); + Assert.That(performedCount, Is.EqualTo(1)); + + // Lose focus + runtime.PlayerFocusLost(); + Assert.That(gamepad.enabled, Is.False); + + // Queue an event while in the background. We don't want to see this event to be processed once focus + // is regained. If there is, the callback will be triggered again. + Press(gamepad.buttonSouth, queueEventOnly: true, time: time++); + + // Run update to try process events accordingly while in the background + InputSystem.Update(); + + // Gain focus + runtime.PlayerFocusGained(); + + // Run update to try process events accordingly once focus is gained + InputSystem.Update(); + + Assert.That(gamepad.enabled, Is.True); + // Confirm that callback was not triggered again once focus was regained + Assert.That(performedCount, Is.EqualTo(1)); + } + [Test] [Category("Devices")] public void Devices_CanMarkDeviceAsBeingAbleToRunInBackground_ThroughIOCTL() diff --git a/Packages/com.unity.inputsystem/InputSystem/InputManager.cs b/Packages/com.unity.inputsystem/InputSystem/InputManager.cs index b70bd38d03..47543eb675 100644 --- a/Packages/com.unity.inputsystem/InputSystem/InputManager.cs +++ b/Packages/com.unity.inputsystem/InputSystem/InputManager.cs @@ -2686,9 +2686,7 @@ internal void OnFocusChanged(bool focus) m_HasFocus = focus; return; } - #endif - #if UNITY_EDITOR var gameViewFocus = m_Settings.editorInputBehaviorInPlayMode; #endif @@ -2934,22 +2932,21 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev var canEarlyOut = // Early out if there's no events to process. eventBuffer.eventCount == 0 - || canFlushBuffer || + || canFlushBuffer + +#if UNITY_EDITOR // If we're in the background and not supposed to process events in this update (but somehow // still ended up here), we're done. - ((!gameHasFocus || gameShouldGetInputRegardlessOfFocus) && + || ((!gameHasFocus || gameShouldGetInputRegardlessOfFocus) && ((m_Settings.backgroundBehavior == InputSettings.BackgroundBehavior.ResetAndDisableAllDevices && updateType != InputUpdateType.Editor) -#if UNITY_EDITOR || (m_Settings.editorInputBehaviorInPlayMode == InputSettings.EditorInputBehaviorInPlayMode.AllDevicesRespectGameViewFocus && updateType != InputUpdateType.Editor) || (m_Settings.backgroundBehavior == InputSettings.BackgroundBehavior.IgnoreFocus && m_Settings.editorInputBehaviorInPlayMode == InputSettings.EditorInputBehaviorInPlayMode.AllDeviceInputAlwaysGoesToGameView && updateType == InputUpdateType.Editor) -#endif ) -#if UNITY_EDITOR // When the game is playing and has focus, we never process input in editor updates. All we // do is just switch to editor state buffers and then exit. - || (gameIsPlaying && gameHasFocus && updateType == InputUpdateType.Editor) + || (gameIsPlaying && gameHasFocus && updateType == InputUpdateType.Editor)) #endif - ); + ; #if UNITY_EDITOR @@ -3124,7 +3121,7 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev } } } - #endif +#endif // If device is disabled, we let the event through only in certain cases. // Removal and configuration change events should always be processed. From bd2f36a9a112529239232e7adf36b5a2e868539a Mon Sep 17 00:00:00 2001 From: Rob Jessop Date: Thu, 23 Nov 2023 20:01:01 +0000 Subject: [PATCH 04/82] FIX: remove globalnamespace from filter.yml as it removes *all* API docs (#1803) hideGlobalNamespace config variable is preferred for this use-case. --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + Packages/com.unity.inputsystem/Documentation~/filter.yml | 3 --- .../com.unity.inputsystem/Documentation~/projectMetadata.json | 3 +++ 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 Packages/com.unity.inputsystem/Documentation~/projectMetadata.json diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 74c0c112ca..91cc011bc1 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -12,6 +12,7 @@ however, it has to be formatted properly to pass verification tests. ### Fixed - Fixed missing confirmation popup when deleting a control scheme. +- Fixed Documentation~/filter.yml GlobalNamespace rule removing all API documentation. ## [1.8.0-pre.2] - 2023-11-09 diff --git a/Packages/com.unity.inputsystem/Documentation~/filter.yml b/Packages/com.unity.inputsystem/Documentation~/filter.yml index 7a67e9f97e..844f071c39 100644 --- a/Packages/com.unity.inputsystem/Documentation~/filter.yml +++ b/Packages/com.unity.inputsystem/Documentation~/filter.yml @@ -31,9 +31,6 @@ apiRules: hasAttribute: uid: System.ObsoleteAttribute type: Type - - exclude: - uidRegex: ^Global Namespace$ - type: Namespace - exclude: uidRegex: ^UnityEngine\.InputSystem\.Samples\..*$ type: Namespace diff --git a/Packages/com.unity.inputsystem/Documentation~/projectMetadata.json b/Packages/com.unity.inputsystem/Documentation~/projectMetadata.json new file mode 100644 index 0000000000..fe955ab06e --- /dev/null +++ b/Packages/com.unity.inputsystem/Documentation~/projectMetadata.json @@ -0,0 +1,3 @@ +{ + "hideGlobalNamespace": true +} \ No newline at end of file From 67cd712900261dc4af4bda29f9d291d54ef32667 Mon Sep 17 00:00:00 2001 From: James McGill Date: Fri, 24 Nov 2023 09:23:42 +0100 Subject: [PATCH 05/82] FIX: Ensure project wide actions template path is fully qualified (#1802) --- .../Editor/ProjectWideActions/ProjectWideActionsAsset.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsAsset.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsAsset.cs index 77a3614f0e..6fb0261015 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsAsset.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsAsset.cs @@ -53,7 +53,7 @@ internal static InputActionAsset GetOrCreate() internal static InputActionAsset CreateNewActionAsset() { - var json = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, s_DefaultAssetPath)); + var json = File.ReadAllText(FileUtil.GetPhysicalPath(s_DefaultAssetPath)); var asset = ScriptableObject.CreateInstance(); asset.LoadFromJson(json); From dfc7b874184c9b421fe6de2b8df4710f0cce790a Mon Sep 17 00:00:00 2001 From: Rita Merkl <127492464+ritamerkl@users.noreply.github.com> Date: Fri, 24 Nov 2023 18:08:41 +0100 Subject: [PATCH 06/82] FIX: Style and activators for Add bindings and composites button (ISX-1717) (#1800) * fixed left/right click for add bindings button & adjusted icon * fixed event propagation issue * small style fix * added changelog * changelog fix * Fixed: add bindings and composites on element right click as well * format fix --- Packages/com.unity.inputsystem/CHANGELOG.md | 3 +++ .../Resources/InputActionsEditorStyles.uss | 10 ++++++++++ .../Resources/InputActionsTreeViewItem.uxml | 4 ++-- .../UITKAssetEditor/Views/ActionsTreeView.cs | 5 +++-- .../UITKAssetEditor/Views/ContextMenu.cs | 18 +++++++++++++++--- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 91cc011bc1..fdc18f51be 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -12,8 +12,11 @@ however, it has to be formatted properly to pass verification tests. ### Fixed - Fixed missing confirmation popup when deleting a control scheme. +- Fixed add bindings button to support left button click. +- Fixed icon for adding bindings and composites button. - Fixed Documentation~/filter.yml GlobalNamespace rule removing all API documentation. + ## [1.8.0-pre.2] - 2023-11-09 ### Changed diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsEditorStyles.uss b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsEditorStyles.uss index c495377ead..7157ae4da6 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsEditorStyles.uss +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsEditorStyles.uss @@ -181,6 +181,16 @@ background-image: resource('d_Toolbar Minus.png'); } +.add-binging-button-dark-theme { + background-image: resource('d_Toolbar Plus More.png'); + -unity-background-scale-mode: scale-to-fit; +} + +.add-binging-button { + background-image: resource('Toolbar Plus More.png'); + -unity-background-scale-mode: scale-to-fit; +} + .search-field { display: none; width: 190px; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsTreeViewItem.uxml b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsTreeViewItem.uxml index bd6564b42e..0e2e72be25 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsTreeViewItem.uxml +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Resources/InputActionsTreeViewItem.uxml @@ -2,10 +2,10 @@