com.unity.inputsystem 1.1.0-preview.3
Notes: processedReleased February 5, 2021
Unity Compatibility
Minimum Unity: 2019.4
Package Dependencies
No dependency metadata provided.
📈 Improvements
- An upper limit of 1024 controls per device and 1kb of memory state per device has been introduced.
- - This allows for certain optimizations.
- - Should the limits prove too tight, they can be raised in the future.
- - The most complex device we have at the moment (`Touchscreen`) has 242 controls and 616 bytes of state.
- `TouchSimulation` now **disables** the `Pointer` devices it reads input from.
- - This is to address the problem of mouse input leading to **both** mouse and touch input happening concurrently. Instead, enabling touch simulation will now effectively **replace** mouse and pen input with touch input.
- - Devices such `Mouse` and `Pen` will remain in place but will not get updated. Events received for them will be consumed by `TouchSimulation`.
- Enabled XR device support on Switch.
🔧 Bug Fixes
- Fixed precompiled layouts such as `FastKeyboard` leading to build time regressions with il2cpp (case 1283676).
- Fixed `InputDevice.canRunInBackground` not being correctly set for VR devices (thus not allowing them to receive input while the application is not focused).
- Fixed `InputUser.OnEvent` and `RebindingOperation.OnEvent` exhibiting bad performance profiles and leading to multi-millisecond input update times (case 1253371).
- - In our own measurements, `InputUser.OnEvent` is >9 times faster than before and `RebindingOperation.OnEvent` is ~2.5 times faster.
- Fixed PS4 controller not recognized on Mac when connected over Bluetooth (case 1286449).
- Fixed `EnhancedTouch` leaking `NativeArray` memory on domain reloads (case 1190150).
- Fixed `TouchSimulation` leading to `"Pointer should have exited all objects before being removed"` errors (case 1190150).
- Fixed multi-touch not working with `InputSystemUIInputModule` (case 1271942).
- - This also manifested itself when using On-Screen Controls and not being able to use multiple controls at the same time (for example, in the Warriors demo).
- Fixed restart prompt after package installation not appearing on Unity 2020.2+ (case 1292513).
- Fixed action with multiple bindings getting stuck in `Performed` state when two or more controls are pressed at the same time (case 1295535).
- - Regression introduced in 1.1-preview.2.
- Fixed `Touch.activeTouches` having incorrect touch phases after calling `EnhancedTouch.Disable()` and then `EnhancedTouch.Enable()` (case 1286865).
- Fixed compile errors related to XR/AR on console platforms.
- #### Actions
- Fixed actions not triggering correctly when multiple bindings on the same action were referencing the same control (case 1293808).
- - Bindings will now "claim" controls during resolution. If several bindings **on the same action** resolve to the same control, only the first such binding will successfully resolve to the control. Subsequent bindings will only resolve to controls not already referenced by other bindings on the action.
- ```CSharp
- var action = new InputAction();
- action.AddBinding("/buttonSouth");
- action.AddBinding("/buttonSouth"); // Will be ignored.
- action.AddBinding("/button*"); // Will only receive buttonWest, buttonEast, and buttonNorth.
- ```
- - This also means that `InputAction.controls` will now only contain any control at most once.
- Fixed JSON serialization of action maps not preserving empty binding paths (case 1231968).
✨ Features
- Added a new high-performance way to iterate over changed controls in an event.
- ```CSharp
- // Can optionally specify a magnitude threshold that controls must cross.
- // NOTE: This will note allocate GC memory.
- foreach (var control in eventPtr.EnumerateChangedControls(magnitudeThreshold: 0.1f))
- Debug.Log($"Control {control} changed state");
- ```
- - This can be used, for example, to implement much more performant "any button pressed?" queries.
- ```CSharp
- InputSystem.onEvent +=
- (eventPtr, device) =>
- {
- // Ignore anything that is not a state event.
- var eventType = eventPtr.type;
- if (eventType != StateEvent.Type && eventType != DeltaStateEvent.Type)
- return;
- // Find all changed controls actuated above the button press threshold.
- foreach (var control in eventPtr.EnumerateChangedControls
- (device: device, magnitudeThreshold: InputSystem.settings.defaultButtonPressThreshold))
- // Check if it's a button.
- if (control is ButtonControl button)
- Debug.Log($"Button {button} was pressed");
- }
- ```
- - Added support for Step Counter sensors for iOS.
- - You need to enable **Motion Usage** under Input System settings before using the sensor. You can also manually add **Privacy - Motion Usage Description** to your application's Info.plist file.
