Skip to content

Commit 2879d8b

Browse files
author
Rene Damm
authored
FIX: Redo much of InputSystemUIInputModule (#1082).
1 parent bf89104 commit 2879d8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3782
-1971
lines changed

Assets/Tests/InputSystem/APIVerificationTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@ void CheckHTMLFileLinkConsistency(string htmlFile, List<string> unresolvedLinks,
512512
}
513513
}
514514

515+
////TODO: add verification of *online* links to this; probably prone to instability and maybe they shouldn't fail tests but would
516+
//// be great to have some way of diagnosing links that have gone stale
515517
[Test]
516518
[Category("API")]
517519
#if UNITY_EDITOR_OSX

Assets/Tests/InputSystem/CoreTests_Actions.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,42 @@ public void Actions_CanReadValueFromAction_InCallback()
739739
Assert.That(receivedValue, Is.EqualTo(1).Within(0.00001));
740740
}
741741

742+
[Test]
743+
[Category("Actions")]
744+
public void Actions_CanReadValueFromAction_InCallback_AsButton()
745+
{
746+
InputSystem.settings.defaultButtonPressPoint = 0.5f;
747+
748+
var action = new InputAction(binding: "<Gamepad>/leftTrigger");
749+
var gamepad = InputSystem.AddDevice<Gamepad>();
750+
751+
action.Enable();
752+
753+
bool? receivedValue = null;
754+
action.performed +=
755+
ctx =>
756+
{
757+
Assert.That(receivedValue, Is.Null);
758+
receivedValue = ctx.ReadValueAsButton();
759+
};
760+
761+
Set(gamepad.leftTrigger, 0.25f);
762+
763+
Assert.That(receivedValue, Is.False);
764+
765+
receivedValue = null;
766+
767+
Set(gamepad.leftTrigger, 0.75f);
768+
769+
Assert.That(receivedValue, Is.True);
770+
771+
receivedValue = null;
772+
773+
Set(gamepad.leftTrigger, 0.15f);
774+
775+
Assert.That(receivedValue, Is.False);
776+
}
777+
742778
// Some code needs to be able to just generically transfer values from A to B. For this, the
743779
// generic ReadValue<TValue>() API isn't sufficient.
744780
[Test]

Assets/Tests/InputSystem/Plugins/UITests.cs

Lines changed: 1801 additions & 745 deletions
Large diffs are not rendered by default.

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,23 @@ however, it has to be formatted properly to pass verification tests.
99

1010
## [Unreleased]
1111

12+
### Changed
13+
14+
* `InputSystemUIInputModule.trackedDeviceSelect` has been removed. Use `InputSystemUIInputModule.leftClick` instead.
15+
* `InputSystemUIInputModule.repeatDelay` has been renamed to `moveRepeatDelay` and `repeatRate` has been renamed to `moveRepeatRate`.
16+
1217
### Fixed
18+
1319
- Fixed CS0109 warning being generated during player build due to use of `new` with the `PlayerInput.camera property`. (case 1174688)
20+
- Fixed a number of issues in `InputSystemUIInputModule`.
21+
* Fixed GC heap garbage when click-dragging.
22+
* Fixed number of pointer states growing indefinitely if OS did not reuse touch IDs.
23+
* Fixed `lastPress` on `PointerEventData` getting lost.
24+
* Fixed button press-and-release happening in same frame resulting in no UI input.
25+
* Fixed clicks initiated from non-pointer devices resulting in pointer inputs with `(0,0)` positions.
26+
* Fixed huge screen deltas on pointer events from tracked devices.
27+
* Fixed touch input not sending pointer exit events ([case 1213550](https://issuetracker.unity3d.com/issues/input-system-onpointerexit-does-not-work)).
28+
- Fixed `TrackedDeviceRaycaster` not setting `screenPosition` in `RaycastResult`.
1429

1530
#### Actions
1631

@@ -20,6 +35,16 @@ however, it has to be formatted properly to pass verification tests.
2035
- `PressInteraction` no longer misses the next button press if it gets reset from within the `performed` callback ([case 1205285](https://issuetracker.unity3d.com/issues/inputsystem-problem-with-button-state-after-deactivating-and-reactivating-an-action-map)).
2136
- `InputBinding.DisplayStringOptions.DontIncludeInteractions` is now properly respected.
2237
- Reading the value of a composite binding no longer causes processors from the last active part binding to be applied rather than the processors of the composite itself, if any ([case 1207082](https://issuetracker.unity3d.com/issues/input-system-invert-processors-have-no-effect-on-the-inputaction-dot-callbackcontext-value)).
38+
- Fixed `InputSystem.onActionChange` getting invoked too many times on binding changes.
39+
40+
### Added
41+
42+
- `InputSystemUIInputModule` now sends pointer events using a new `ExtendedPointerEventData` instead of using the base `PointerEventData` class. This surfaces additional input data in pointer events.
43+
- Added `InputSystemUIInputModule.pointerBehavior` to allow dictating how the UI will resolve concurrent input from multiple pointers.
44+
45+
####
46+
47+
- Added `InputAction.CallbackContext.ReadValueAsButton`.
2348

2449
## [1.0.0-preview.5] - 2020-02-14
2550

-10.5 KB
Loading
23.5 KB
Loading
90.3 KB
Loading

Packages/com.unity.inputsystem/Documentation~/Installation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ To fully switch from the old Input Manager to the new Input System for a Project
2626
![Switch Active Input Handling](Images/ActiveInputHandling.png)
2727

2828
>__Note__: You must restart the Unity Editor before this setting takes effect.
29+
30+
When the new input backends are enabled, the `ENABLE_INPUT_SYSTEM=1` C# `#define` is added to builds. Similarly, when the old input backends are enabled, the `ENABLE_LEGACY_INPUT_MANAGER=1` C# `#define` is added. Because both can be enabled at the same time, it is possible for __both__ defines to be 1 at the same time.

Packages/com.unity.inputsystem/Documentation~/KnownLimitations.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ The following is a list of known limitations that the Input System currently has
88
* The Input System cannot generate input for IMGUI or UIElements.
99
* The Input System does not yet support the new 2019.3 mode where domain reloads are disabled when entering play mode.
1010

11+
### uGUI
12+
13+
* After enabling, the UI will not react to a pointer's position until the position is changed.
14+
1115
## Device support
1216

1317
* (Windows) Mouse input from remote desktop connections does not come through properly.

Packages/com.unity.inputsystem/Documentation~/Migration.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ This guide provides a list of APIs in `UnityEngine.Input` (and other related API
44

55
>__Note__: All of the new APIs are in the `UnityEngine.InputSystem` namespace. The namespace is omitted here for brevity. `UnityEngine.InputSystem` is referenced in full for easy disambiguation.
66
7+
Note that it is possible to have code for the old and the new input system at the same time using conditional compilation. When the new input system is enabled in the player preferences (see [here](./Installation.md#enabling-the-new-input-backends)), the `ENABLE_INPUT_SYSTEM` preprocessor directive is available.
8+
9+
```CSharp
10+
#if ENABLE_INPUT_SYSTEM
11+
// New input system backends are enabled.
12+
#endif
13+
14+
#if ENABLE_LEGACY_INPUT_MANAGER
15+
// Old input backends are enabled.
16+
#endif
17+
18+
// NOTE: Both can be true at the same time as it is possible to select "Both"
19+
// under "Active Input Handling".
20+
```
21+
722
## [`UnityEngine.Input`](https://docs.unity3d.com/ScriptReference/Input.html)
823

924
### [`UnityEngine.Input.acceleration`](https://docs.unity3d.com/ScriptReference/Input-acceleration.html)

0 commit comments

Comments
 (0)