com.unity.inputsystem 0.9.1-preview

com.unity.inputsystem

Notes: processedReleased August 8, 2019

Browse versions

PreviousNext

Unity Compatibility

Minimum Unity: 2019.1

Package Dependencies

🔧 Bug Fixes

  • Fixed GC heap garbage being caused by triggered by event processing.
  • - This meant that every processing of input would trigger garbage being allocated on the managed heap. The culprit was a peculiarity in the C# compiler which caused a struct in `InputEventPtr.IsA` to be allocated on the heap.
  • The bindings selection popup window will now show child controls matching the current action type even if the parent control does not match.
  • Fixed `duration` values reported for Hold and Press interactions.
  • DualShock 3 on macOS:
  • - Fixed actions bound to the dpad control performing correctly.
  • - Fixed non-present touchpad button control being triggered incorrectly.
  • Fixed compile issues with switch classes on standalone Linux.
  • Leak of unmanaged memory in `InputControlList`.
  • #### Actions
  • Fixed actions not updating their set of controls when the usages of a device are changed.
  • Composite bindings with the default interaction will now correctly cancel when the composite is released, even if there are multiple composite bindings on the action.

📈 Improvements

  • `MouseState`, `KeyboardState`, and `GamepadState` have been made public again.
  • `PlayerInput` and `PlayerInputManager` have been moved from the `UnityEngine.InputSystem.PlayerInput` namespace to `UnityEngine.InputSystem`.
  • The signature of `InputSystem.onEvent` has changed. The callback now takes a second argument which is the device the given event is sent to (null if there's no corresponding `InputDevice`).
  • ```
  • // Before:
  • InputSystem.onEvent +=
  • eventPtr =>
  • {
  • var device = InputSystem.GetDeviceById(eventPtr.deviceId);
  • //...
  • };
  • // Now:
  • InputSystem.onEvent +=
  • (eventPtr, device) =>
  • {
  • //...
  • };
  • ```
  • The signatures of `InputSystem.onBeforeUpdate` and `InputSystem.onAfterUpdate` have changed. The callbacks no longer receive an `InputUpdateType` argument.
  • - Use `InputState.currentUpdateType` in case you need to know the type of update being run.
  • `InputUpdateType` has been moved to the `UnityEngine.InputSystem.LowLevel` namespace.
  • `InputSystem.Update(InputUpdateType)` has been removed from the public API.
  • The way input devices are built internally has been streamlined.
  • - `InputDeviceBuilder` is now internal. It is no longer necessary to access it to look up child controls. Simply use `InputControl.GetChildControl` instead.
  • - To build a device without adding it to the system, call the newly added `InputDevice.Build` method.
  • ```
  • InputDevice.Build();
  • ```
  • - `InputSystem.SetLayoutVariant` has been removed. Layout variants can no longer be set retroactively but must be decided on as part of device creation.
  • `InputSystem.RegisterControlProcessor` has been renamed to just `InputSystem.RegisterProcessor`.
  • #### Actions
  • `InputAction.ReadValue()` is longer correlated to `InputAction.triggered`. It simply returns the current value of a bound control or composite while the action is being interacted with.
  • `InputInteractionContext.PerformedAndGoBackToWaiting` has been renamed to just `InputInteractionContext.Performed`.
  • #### Actions
  • Individual composite part bindings can now no longer have interactions assigned to them as that never made any sense.

Features

  • Devices can now have more than one usage.
  • - Call `InputSystem.AddDeviceUsage(device,usage)` to add additional usages to a device.
  • - Call `InputSystem.RemoveDeviceUsage(device,usage)` to remove existing usages from a device.
  • - `InputSystem.SetDeviceUsage(device,usage)` still exists. It will clear all existing usages from the given device.
  • A new `VisualizerSamples` sample that can be installed through the package manager.
  • - Contains two components `InputControlVisualizer` and `InputActionVisualizer` that help visualizing/debugging control/device and action activity through in-game overlays. A few sample scenes illustrate how to use them.
  • #### Actions
  • Added `InputAction.ReadValueAsObject` API.
  • Added `InputAction.activeControl` API.