InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

WIP: Global actions.

Open Rene-Damm opened this issue 3 years ago • 0 comments

Description

Demonstrate the following:

  1. Load an existing, unmodified Unity project (let's say "2D Roguelike") as is.
  2. Add the input system through the package manager.
  3. See zero popups and zero restarts.
  4. Go into play mode and it just works.
  5. Pop open the Projects Settings, see a single "Input" foldout and in there see a new action editing UI (doesn't have to be fully functional; just the essentials).
  6. Change a binding and see it take effect.
  7. Exit play mode and uninstall the input system package.
  8. See zero popups and zero restarts.
  9. Show that the old InputManager is back in Project Settings.
  10. Go into play mode and everything just works the same.

Requirements

Needs 2022.2 with native-side changes.

Branch: https://ono.unity3d.com/unity/unity/changelog?branch=input%2Fv2

unity-downloader-cli -c Editor -u input/v2 --wait

Breaking Changes

  • Unity < 2022.2 no longer supported
  • Can no longer run both the old and the new system in parallel
  • Input package is now com.unity.input and no longer com.unity.inputsystem
    • com.unity.inputsystem would be kept as a shim
  • After installing com.unity.input v2, the behavior of UnityEngine.Input changes

Checklist

  • [x] InputActionAsset linked from InputSystem.settings.actions
  • [x] Automatic migration of InputManager InputAxis settings into InputSystem.settings.actions
  • [x] InputSystem.settings stored in ProjectSettings/
  • [x] InputManager UI not showing in ProjectSettings when input system installed
  • [x] Remove "Active Input Handling" switch from Player Settings
  • [x] Can install Input System package without popups and restarts
  • [x] Can uninstall Input System package without popups and restarts
  • [x] With Input System installed, new implementation of UnityEngine.Input overrides existing implementation in Modules/InputLegacy
  • [x] GetAxis, GetButton, GetButtonUp, GetButtonDown usable with global actions
  • [x] Can read mouse buttons through GetMouseButton, GetMouseButtonDown, GetMouseButtonUp
  • [x] Can read keyboard keys through GetKey, GetKeyUp, GetKeyDown
  • [ ] Can read touch input through UnityEngine.Input.touches
  • [ ] Can receive mouse input through magic OnMouseXXX methods
  • [x] Can see ~and edit~ actions through Project Settings >> Input
  • [x] Can see and edit input settings through Project Settings >> Input >> Advanced
  • [x] "Active Input Handling" is set automatically based on presence of package
  • [x] Can play 2D Roquelike sample as is after installing Input System package
  • [x] Can play 2D Roguelike sample as is after un-installing Input System package

Stretch

  • [ ] Can access global actions through code-generated API added to UnityEngine.Input (e.g. Input.Fire.WasPressed()).
  • [ ] Link existing .inputactions asset into InputSystem.settings

Before review:

  • [ ] Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • FogBugz ticket attached, example ([case %number%](https://issuetracker.unity3d.com/issues/...)).
    • FogBugz is marked as "Resolved" with next release version correctly set.
  • [ ] Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • [ ] Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • [ ] Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

Issues

  • Once the device discovery queue in the backend has been flushed, it is flushed. So, after uninstalling the input system and then reinstalling it in the same session, prior discoveries (mouse, keyboard, etc) are gone.
  • Currently relies on assembly overrides which are pretty broken. There's a new mechanism coming for overriding assemblies which hopefully provides us with a better avenue for handling this.
  • Uninstalling currently throws exceptions which seem to be coming from the assembly override mechanism. Should be solved when we switch to the new assembly versioning mechanism.

Rene-Damm avatar Feb 07 '22 17:02 Rene-Damm