InputSystem Changelog

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

0.2.0-preview #

12 Feb 2019

Changed
Added
Fixes
Known Issues

This release contains a number of fairly significant changes. The focus has been on further improving the action system to make it easier to use as well as to make it work more reliably and predictably.

NOTE: There are some breaking changes. Please see the "Changed" section below.

Changed

  • Removed Unity 2018.2 support code.
  • Removed .NET 3.5 support code.
  • Started using C# 7.
  • IInputControlProcessor<TValue> has been replaced with InputProcessor and InputProcessor<TValue> base classes.
  • IInputBindingComposite has been replaced with an InputBindingComposite base class and the IInputBindingComposite<TValue> interface has been merged with the InputBindingComposite<TValue> class which had already existed.
  • InputUser.onUnpairedDeviceUser will now notify for each actuated control until the device is paired or there are no more actuated controls.
  • SensitivityProcessor has been removed.
    • The approach needs rethinking. What SensitivityProcessor did caused more problems than it solved.
  • State monitors no longer have their timeouts removed automatically when they fire. This makes it possible to have a timeout that is removed only in response to a specific state change.
  • Events for devices that implement IInputStateCallbacks (such as Touchscreen) are allowed to go back in time. Avoids the problem of having to order events between multiple fingers correctly or seeing events getting rejected.
  • PenState.Button is now PenButton.
  • Removed TouchPositionTransformProcessor, was used only by Android, the position transformation will occur in native backend in 2019.x

Actions:

  • Bindings that have no interactions on them will trigger differently now. This is a breaking change.
    • Previously, these bindings would trigger performed on every value change including when going back to their default value. This is why you would see two calls of performed with a button; one when the button was pressed, another when it was depressed.
    • Now, a binding without an interaction will trigger started and then performed when a bound control is actuated. Thereafter, the action will remain in Started phase. For as long as the control is actuated, every value change will trigger performed again. When the control stops being actuated, it will trigger cancelled and the action will remain in Waiting state.
    • Control actuation is defined as a control having a magnitude (see InputControl.EvaluateMagnitude) greater than zero. If a control does not support magnitudes (returns -1 from EvaluateMagnitude), then the control is considered actuated when it changes state away from its default state.
    • To restore the previous behavior, simply change code like
        myAction.performed += MyCallback;
      
      to
        myAction.performed += MyCallback;
        myAction.cancelled += MyCallback;
      
    • Alternatively, enable passThrough mode on an action. This effectively restores the previous default behavior of actions.
          new InputAction(binding: "<Gamepad>/leftTrigger") { passThrough = true };
      
  • As part of the aforementioned change, the following interactions have been removed as they are no longer relevant:
    • StickInteraction: Can simply be removed from bindings. The new default behavior obsoletes the need for what StickInteraction did. Use started to know then the stick starts being actuated, performed to be updated on movements, and cancelled to know when the stick goes back into rest position.
    • PressAndReleaseInteraction: Can simply be removed from bindings. The default behavior with no interaction encompasses press and release detection. Use started to know then a button is pressed and cancelled to know when it is released. To set a custom button press point, simply put an AxisDeadzoneProcessor on the binding.
  • PressInteraction has been completely rewritten.
    • Trigger behavior can be set through behavior parameter and now provides options for observing just presses (PressOnly), just releases (ReleaseOnly), or both presses and releases (PressAndRelease).
    • Also, the interaction now operates on control actuation rather than reading out float values directly. This means that any control that supports magnitudes can be used.
    • Also supports continuous mode now.
  • If bound controls are already actuated when an action is enabled, the action will now trigger in the next input update as if the control had just been moved from non-actuated to actuated state.
    • In other words, if e.g. you have a binding to the A button of the gamepad and the A button is already pressed when the action is first enabled, then the action associated with the A button will trigger as if the button had just been pressed. Previously, it required releasing and re-pressing the button first -- which, together with certain interactions, could lead to actions ending up in a confused state.
  • When an action is disabled, it will now cancel all ongoing interactions, if any (i.e. you will see InputAction.cancelled being called).
    • Note that unlike the above-mentioned callbacks that happen when an action starts out with a control already actuated, the cancellation callbacks happen immediately rather than in the next input update.
  • Actions that at runtime are bound to multiple controls will now perform conflict resolution, if necessary.
    • This applies only if an action actually receives multiple concurrent actuations from controls.
    • When ambiguity is detected, the greatest amount of actuation on any of the controls gets to drive the action.
    • In practice, this means that as long as any of the controls bound to an action is actuated, the action will keep going. This resolves ambiguities when an action has primary and secondary bindings, for examples, or when an action is bound to multiple different devices at the same time.
    • Composite bindings count as single actuations regardless of how many controls participate in the composite.
    • This behavior can be bypassed by setting the action to be pass-through.
  • Action editor now closes when asset is deleted.
    • If there are unsaved changes, asks for confirmation first.
  • Interactions and processors in the UI are now filtered based on the type of the action (if set) and sorted by name.
  • Renamed "Axis" and "Dpad" composites to "1D Axis" and "2D Vector" composite.
    • The old names can still be used and existing data will load as expected.
    • DpadComposite got renamed to Vector2Composite; AxisComposite is unchanged.
  • InputInteractionContext.controlHasDefaultValue has been replaced with InputInteractionContext.ControlIsActuated().
  • InputActionChange.BindingsHaveChangedWhileEnabled has been reworked and split in two:
    1. InputActionChange.BoundControlsAboutToChange: Bindings have been previously resolved but are about to be re-resolved.
    2. InputActionChange.BoundControlsChanged: Bindings have been resolved on one or more actions.
  • Actions internally now allocate unmanaged memory.
    • Disposing should be taken care of automatically (though you can manually Dispose as well). If you see errors in the console log about unmanaged memory being leaked, please report the bug.
    • All execution state except for C# heap objects for processors, interactions, and composites has been collapsed into a single block of unmanaged memory. Actions should now be able to re-resolve efficiently without allocating additional GC memory.

Added

  • PlayerInput component which simplifies setting up individual player input actions and device pairings.
    PlayerInputAn image to describe post
  • PlayerInputManager component which simplifies player joining and split-screen setups.
    PlayerInputAn image to describe post
  • InputDevice.all (equivalent to InputSystem.devices)
  • InputControl.IsActuated() can be used to determine whether control is currently actuated (defined as extension method in InputControlExtensions).
  • Can now read control values from buffers as objects using InputControl.ReadValueFromBufferAsObject. This allows reading a value stored in memory without having to know the value type.
  • New processors:
    • ScaleProcessor
    • ScaleVector2Processor
    • ScaleVector3Processor
    • InvertVector2Processor
    • InvertVector3Processor
    • NormalizeVector2Processor
    • NormalizeVector3Processor
  • Added MultiTapInteraction. Can be used to listen for double-taps and the like.
  • Can get total and average event lag times through InputMetrics.totalEventLagTime and InputMetrics.averageEventLagTime.
  • Mouse.forwardButton and Mouse.backButton.
  • The input debugger now shows users along with their paired devices and actions. See the documentation
  • Added third and fourth barrel buttons on Pen.

Actions:

  • Actions have a new continuous mode that will cause the action to trigger continuously even if there is no input. See the documentation for details.
    Continuous ActionAn image to describe post
  • Actions have a new pass-through mode. In this mode an action will bypass any checks on control actuation and let any input activity on the action directly flow through. See the documentation for details.
    Pass-Through ActionAn image to describe post
  • Can now add interactions and processors directly to actions. Action PropertiesAn image to describe post
    • This is functionally equivalent to adding the respective processors and/or interactions to every binding on the action.
  • Can now change the type of a composite retroactively. Composite PropertiesAn image to describe post
  • Values can now be read out as objects using InputAction.CallbackContext.ReadValueAsObject().
    • Allocates GC memory. Should not be used during normal gameplay but is very useful for testing and debugging.
  • Added auto-save mode for .inputactions editor. Auto SaveAn image to describe post
  • Processors, interactions, and composites can now define their own parameter editor UIs by deriving from InputParameterEditor. This solves the problem of these elements not making it clear that the parameters usually have global defaults and do not need to be edited except if local overrides are necessary.
  • Can now set custom min and max values for axis composites.
    var action = new InputAction();
    action.AddCompositeBinding("Axis(minValue=0,maxValue=2)")
        .With("Positive", "<Keyboard>/a")
        .With("Negative", "<Keyboard>/d");
    
  • "C# Class File" property on .inputactions importer settings now has a file picker next to it.
  • InputActionTrace has seen various improvements.
    • Recorded data will now stay valid even if actions are rebound to different controls.
    • Can listen to all actions using InputActionTrace.SubscribeToAll.
    • InputActionTrace now maintains a list of subscriptions. Add subscriptions with SubscribeTo and remove a subscription with UnsubscribeFrom. See the documentation for details.

Fixes

  • Fixed support for Unity 2019.1 where we landed a native API change.
  • InputUser.UnpairDevicesAndRemoveUser() corrupting device pairings of other InputUsers
  • Control picker in UI having no devices if list of supported devices is empty but not null
  • IndexOutOfRangeException when having multiple action maps in an asset (#359 and #358).
  • Interactions timing out even if there was a pending event that would complete the interaction in time.
  • Action editor updates when asset is renamed or moved.
  • Exceptions when removing action in last position of action map.
  • Devices marked as unsupported in input settings getting added back on domain reload.
  • Fixed Pen causing exceptions and asserts.
  • Composites that assign multiple bindings to parts failing to set up properly when parts are assigned out of order (#410).

Known Issues

  • Input processing in edit mode on 2019.1 is sporadic rather than happening on every editor update.