InputSystem Changelog

This changelog showcases the ability to render changelogs in the "keep a changelog" format

1.1.0-preview.3 #

04 Feb 2021

Changed
Fixed
Added

Changed

  • 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.

Fixed

  • Fixed Right stick to use AXIS.Z and AXIS.RZ for Android gamepads.
  • Fixed triggers to always use Axis.Gas and Axis.Brake for Android gamepads.
  • 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.
    var action = new InputAction();
    action.AddBinding("<Gamepad>/buttonSouth");
    action.AddBinding("<Gamepad>/buttonSouth"); // Will be ignored.
    action.AddBinding("<Gamepad>/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).

Added

  • Added DualShock4GamepadAndroid and XboxOneGamepadAndroid layout for Android
  • Added a new high-performance way to iterate over changed controls in an event.
    // 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.
    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.