Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Official Version 1.1 and General Update

Discussion in 'Input System' started by Rene-Damm, Sep 10, 2021.

  1. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Hey everyone,

    Quick update on the state of affairs around input.

    New Release

    Version 1.1 verified of the Input System package is now live.

    It includes a year of bugfixes and improvements. Some highlights:
    • Easier button polling
    Code (CSharp):
    1. action.IsPressed()
    2. action.WasPressedThisFrame()
    3. action.WasReleasedThisFrame()
    • Easier “any key” detection
    Code (CSharp):
    1. InputSystem.onAnyButtonPress
    2.     .CallOnce(button => Debug.Log($"Button {button} pressed"));
    • Saving and loading rebinds as JSON
    Code (CSharp):
    1. void SaveUserRebinds(PlayerInput player)
    2. {
    3.     var rebinds = player.actions.SaveBindingOverridesAsJson();
    4.     PlayerPrefs.SetString("rebinds", rebinds);
    5. }
    6.  
    7. void LoadUserRebinds(PlayerInput player)
    8. {
    9.     var rebinds = PlayerPrefs.GetString("rebinds");
    10.     player.actions.LoadBindingOverridesFromJson(rebinds);
    11. }


    For a full list of changes, please see the CHANGELOG.

    New Team

    In the past, we had a number of resourcing problems. Over the past couple of months, a new team has formed.
    • Håkan - Lead

    • Gabe - Project Management

    • Stefan - QA

    • William - UX

    • Dmytro - Developer

    • Andrew - Developer

    • Rene - Developer
    New Future

    While we will continue to work on stability and performance improvements, we consider usability and workflow improvements our one top priority going forward. While the current package offers many tools and pieces, we have a general lack of clarity and simplicity in how to put these tools and pieces to use.

    Other than this, we do have a small number of oft-repeated feature requests (like the “SHIFT+B” and “B” binding problem) and incompatibilities (Unity Remote) that we consider pressing.

    Instead of embarking on a long preview cycle, as we did with 1.1, we intend to instead roll out more frequent patch releases containing fixes. These updates will automatically be applied by the Unity package manager to the current 1.1 release.
     
    Last edited: Sep 11, 2021
    mrtenda, Wattosan, petey and 15 others like this.
  2. Roboserg

    Roboserg

    Joined:
    Jun 3, 2018
    Posts:
    83
    Nice! However the package manager still shows me 1.0.2 as the latest version. When could we expect 1.1 hitting the package manager? I even see "[1.1.1] - 2021-09-03" in the change log already, yet no 1.1 in the package manager?
     
  3. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    I believe you should be able to upgrade to 1.1.1 in package manager already, at least if you manually enter 1.1.1 string in the manifest it should work.
    1.1.1 will be default in 2021.2, 2022.1 soon if not already, and in 2019.4, 2020.3, 2021.1 a bit later
     
    mariandev and Roboserg like this.
  4. Roboserg

    Roboserg

    Joined:
    Jun 3, 2018
    Posts:
    83
    Thanks. I had to manually add by name "com.unity.inputsystem" for 1.1.1 to be visible.
     
    Kogar and reinfeldx like this.
  5. It already pops up for me in 2021.2b10 for update as 'Release' version.
     
  6. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,568
    Is the pen pressure / tilt now available in the editor for editor tools?
    Or is it play-mode only.

    Thanks for the hard work!
     
  7. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    There was improved pen support for IMGUI events being worked on some time ago from the editor side but looking into it, seems that hasn't yet made it out the pipes. It being part of
    UnityEngine.Event
    IMO is the "proper"/better way in this case than the input system serving the data.

    As far as the input system is concerned, the edit mode support landscape is so far unchanged. The focus changes affected it tangentially (non-pointer/keyboard devices are now always routed to the game view by default) but for pens, shouldn't have much of an impact. There is still an open bug in that area and overall, edit mode support stands on somewhat shaky legs.
     
    NotaNaN and Lars-Steenhoff like this.
  8. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,568

    Thanks for the status update, I hope this will be all smooth sailing towards unity 2022
     
  9. sitnduck

    sitnduck

    Joined:
    Jun 29, 2016
    Posts:
    15
    Using 2020LTS, not seeing 1.1.1 in the package manager either.

    What is this "manifest" I need to edit? And what exactly should I add? Hopefully this will update itself soon?
     
  10. sitnduck

    sitnduck

    Joined:
    Jun 29, 2016
    Posts:
    15
    Ah ok, it's straight up hardcoding the version in the manifest.json in the project. Upon reloading, Unity auto-installed it. I was a bit worried about doing that change but I guess it worked ;)
     
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    12,015
    Good luck to the new team.
     
  12. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    326
    The Gamepad Mouse Cursor Sample does not work at all when using version 1.1.1.
    Also, version 1.0.2 is unusable for me because of "VirtualMouseInput not supporting UI scaling other than constant."

    Did somebody manage to use VirtualMouseInput on 1.1.1 or does have a fix for the related problem on 1.0.2?
     
  13. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    305
    In the current iteration there is the possibility to directly access the state for a subset of inputs:


    Code (CSharp):
    1. Gamepad.current
    2. Mouse.current
    Is there anything similar planned (or maybe already implemented) for VR controllers and headsets (like the state access without callbacks)?
     
  14. pitchblende

    pitchblende

    Joined:
    Jan 9, 2020
    Posts:
    71
    Is it intentional that calls on an Input Action to
    ReadValue<T>()
    do not work (i.e. always return zero) when called from
    FixedUpdate()
    in 1.1.0-pre.6 and 1.1.1, when Update Mode is set to "Process Events in Dynamic Update"?

    It used to work in earlier versions, so if it's a regression, let me know and I'll file a report...

    EDIT: I can't find any documentation of this change so I've filed a bug report anyway, in case it's a genuine regression. It's 100% reproducible for me, across multiple projects and Unity versions.
     
    Last edited: Sep 22, 2021
    Blepius and reinfeldx like this.
  15. RodGreen

    RodGreen

    Joined:
    Jan 11, 2020
    Posts:
    13
    Latest version of the InputSystem 1.1.1 the stickAction of the VirtualMouseInput always returns 0,0 delta.

    Debugging looks like the OnAfterInputUpdate is only called once after moving the joystick and so the deltaTime value is always 0

    Creating a copy of the class in the project (i.e. in a custom namespace) and using that class fixes the problem - looks like there's a bug with the event callbacks.
     
  16. HrabiaWrzontq

    HrabiaWrzontq

    Joined:
    Nov 28, 2016
    Posts:
    16
    I copied the class but it still did not worked. deltaTime is always 0, but for me it's because every other frame the stick value is always 0 for some reason.
    I added some debug logs with frame counter to test it and here is the result.

    upload_2021-9-23_11-0-2.png

    First time stick value is non zero, so the m_lastTime is saved and because on the first run it is equal to currentTime then deltaTime is 0. On the second run it should enter the else and calculate non zero deltaTime. However, because the stick value is zero, the m_lastTime is reset and nothing happens.
     
  17. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    326
    I gave up on the new Input System, after an hour of trying to solve the problems, I gave up.

    I bought ReWired, after 30 minutes to learn how to use it, everything I needed was working perfectly. Best investment I ever made.
     
  18. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    @wagenheimer would be nice if you could write a short "exit interview" if you like :) I'm just trying to listen and learn what kind of problems you experienced and if anything we could fix to improve it
     
    dannyalgorithmic, petey and NotaNaN like this.
  19. RodGreen

    RodGreen

    Joined:
    Jan 11, 2020
    Posts:
    13
    I found the issue is the input system is managing states with 'Editor' in the mix causing the values to be unset...


    Debugging looks like the OnAfterInputUpdate is called from the 'Dynamic' / 'Fixed' state update but then also called by a 'Editor' state update.
    In the 'Editor' state update the value is 0,0 - which causes the VirtualMouse to reset.

    With Dynamic it looks like they are 1:1 Dynamic update to Editor update so the virtual mouse never moves.

    Would be good if Unity provided a better callback that included the state so we can 'ignore' the editor update callback. Or at the very least allow us to query the current InputSystem state so we can ignore if it's in 'Editor'.

    Because it's been made internal the only way to fix this is to copy the package internally and fix the internal scope limitation.

    Also as a note 'defaultUpdateType' doesn't make a lot of sense for a member name that returns the 'currentUpdateType'??


    Below code fixes the issue (but you have to patch the package, meaning adding it manually to your packages folder):


    Code (CSharp):
    1. private void UpdateMotion()
    2.         {
    3.             if (m_VirtualMouse == null)
    4.                 return;
    5.             #if UNITY_EDITOR
    6.  
    7. if(UnityEngine.InputSystem.InputSystem.s_Manager.defaultUpdateType ==
    8. InputUpdateType.Editor
    9.                 ||
    10. UnityEngine.InputSystem.InputSystem.s_Manager.defaultUpdateType ==
    11. InputUpdateType.None)
    12.                 return;
    13.             #endif
     
  20. pitchblende

    pitchblende

    Joined:
    Jan 9, 2020
    Posts:
    71
    @RodGreen, could this be the reason why sometimes the Cinemachine Orbit camera doesn't respond to X-axis mouse delta inputs when using the Input System Input Provider with 1.1.1? The delta values read by ReadValue are almost always zero, although sometimes glitch to non-zero values, but then "stick" at zero again. I've noticed that alt-tabbing away/back to the Editor makes it work, sometimes, for a few seconds perhaps, but it's highly intermittent and I'm having a lot of trouble figuring out what causes it to come and go.

    It was working fine in 1.1.0-pre.5 and earlier.

    EDIT: nope, I tried your change to
    UpdateMotion
    and it didn't resolve my issue (assuming it got recompiled?). Must be something else then...

    EDIT2: reverted back to 1.1.0-pre.5 and it's all working again - definitely something wrong with 1.1.1. Note my previous post about ReadValue in FixedUpdate being broken too - perhaps related, not sure yet...

    EDIT3: I've determined that my Cinemachine problem is the same problem I mentioned earlier in this thread where ReadValue in FixedUpdate returns zero values. I was seeing intermittent failure in Cinemachine because the Brain was set to Update Mode "Smart Update" which flicks between Late Update (when it works) and Fixed Update (when it doesn't) at its own discretion. If I change the Brain to Late Update then it works fine, and if I change it to FIxed Update then it is 100% broken.

    At this point I'm kind of surprised that nobody else has reported this FixedUpdate issue yet...
     
    Last edited: Sep 24, 2021
    reinfeldx likes this.
  21. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    305
    Before in the Input Debugger there was the option: Lock Input to the Game Window

    In the current release I can't find that option anymore, is this option now somewhere else?

    It allowed having the input to be captured even if the game view wasn't focused. The new settings in the Input System Package (Editor -> Play Mode Input Behaviour -> All Devices Input Always Goes To Game View) seems not to work for me.
     
  22. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    VirtualMouseInput hasn't been changed between 1.1.0-pre.5 and 1.1.1 so it's likely some other changes in the update loop are causing this. So how do I repro this locally? Does it work if you only switch to dynamic updates?
     
  23. RodGreen

    RodGreen

    Joined:
    Jan 11, 2020
    Posts:
    13
    You have to copy the package to your local packages folder to make the change, Unity detects the change if you make it in the Library folder and reverts it.

    Bug report 1367553.
    Dynamic Update doesn't work - fixed update is slightly broken as there's a random 0,0 - inserted into the mix every few callbacks.
    The way to test is to create a VirtualMouseInput component, and see the value is always 0,0 - you can check this with basic debugging or implement a control mapping, that uses it and poll the value.
     
    Last edited: Sep 24, 2021
    dmytro_at_unity likes this.
  24. pitchblende

    pitchblende

    Joined:
    Jan 9, 2020
    Posts:
    71
    @dmytro_at_unity In case it's helpful, I included a repro project in bug report 1367556 that might help you track this down. It's not specifically related to VirtualMouseInput but from what I'm reading here there are definitely some similarities around zero values being read in Fixed Update. My case is more general I think.
     
    dmytro_at_unity and reinfeldx like this.
  25. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    326
    VirtualMouseInput only supports Overlay... If you use a camera it does not work. Is this expected to be fixed in the near future?
     
    reinfeldx likes this.
  26. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    @wagenheimer you imply using VirtualMouseInput to achieve Input.simulateMouseWithTouches-esque behavior to control the camera via Mouse code?

    Maybe, but what VirtualMouseInput gives that InputAction of Vector2 value type doesn't give you?

    Our current approach is to reduce amount of virtual/simulated devices to avoid tricky situations like when simulating mouse with touch and then getting touch input directly as well, it's hard to resolve without explicit ordering/filtering, for example our OnScreenButton is implemented via virtual keyboard, so when pressing it suddenly current input device switches to keyboard which can switch control schemes creating hard-to-debug havoc, or Keyboard.current suddenly becoming a virtual keyboard :(

    But maybe there is some use case which is tricky to implement without virtual mouse.
     
  27. kenzen0

    kenzen0

    Joined:
    Sep 17, 2018
    Posts:
    16
    I looked up "com.unity.inputsystem", but it does not show up in the package manager.
    Unity is
    2021.1.21f1
    2020.3.15f2

    Do I need to install it from somewhere else?
    Also, am I displaying it incorrectly?
     

    Attached Files:

  28. kenzen0 likes this.
  29. kenzen0

    kenzen0

    Joined:
    Sep 17, 2018
    Posts:
    16
  30. pitchblende

    pitchblende

    Joined:
    Jan 9, 2020
    Posts:
    71
    FWIW, you can also install it via the "Install package by git url" option and type "com.unity.inputsystem@1.1.1". This works for any of the tagged versions, just change the version string after the @.

    It should probably be listed here too, as promised here, but maybe I expect too much.
     
  31. GoodArcade

    GoodArcade

    Joined:
    Aug 7, 2013
    Posts:
    7
    WasPressedOnThisFrame is great....however, I have a Vector2 WASD input setup. So if you press A, hold it while you press D, it will register as 'released'. Not really breaking my code but just gotta put this out there
     
  32. Deleted User

    Deleted User

    Guest

    When will the Dualsense (PS5 Controller) support come? It's been a year since the console came out and the support didn't land yet.

    And it's completely mapped wrong when connected via cable -Wired- on Windows PC, however, it works fine if connected via Bluetooth -Wireless-, and also mapped wrong on Android 11 -Samsung Galaxy S20+ 5G- Wired and Wireless.
     
    Neto_Kokku likes this.
  33. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    812
    Deleted User likes this.
  34. Deleted User

    Deleted User

    Guest

    Ok, yeah, there are git hub packages and all that stuff, however, they got issues, even the most advanced one among them -Unisense- still has critical issues and not all features are supported; Besides, we want it to be from Unity Team End themselves which will have it integrated and built-in to the Input System directly into the Unity Editor itself.
     
  35. Arycama

    Arycama

    Joined:
    May 25, 2014
    Posts:
    185
  36. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    This. Players complain about it and all we can do is tell them it's Unity's fault.
     
    Deleted User likes this.
  37. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,568
  38. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Deleted User likes this.
  39. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    Deleted User likes this.
  40. Deleted User

    Deleted User

    Guest

    That's cool, thank you! But, is touchpad movement support (like in PS5 Astro's Playroom game where you roll the ball with touchpad) implemented yet? if not, when?
     
  41. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    Hm, touchpad shouldn't be that hard to implement, but from what I know so far it's not gonna work over Bluetooth at least on macOS, if I'm not mistaken libsdl2 and rewired also has this limitation currently.
     
    Deleted User likes this.
  42. NeonTheCoder

    NeonTheCoder

    Joined:
    Feb 1, 2014
    Posts:
    40
    How would I do this for any other virtual devices? I want to create my own virtual mouse and control it with my own code but cannot because of this bug, however s_Manager is only accessible internally, and the settings have an update mode but I cannot tell if that is related.
     
  43. Blepius

    Blepius

    Joined:
    Mar 9, 2021
    Posts:
    68
    I'm also experiencing this, need to downgrade for now I think. Wish I could participate in the Beta, these are really helpful additions!
     
  44. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    Fix for
    VirtualMouseInput
    landed https://github.com/Unity-Technologies/InputSystem/pull/1415 and will be part of 1.1.2 which will be available soon (in a few weeks)
    It does limit running
    onAfterUpdate
    to only game view updates, so we don't run them in editor mode updates when playing the game. Let me know if this somehow limits any of your usages.
     
  45. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,371
    Could we, pretty please with cherry on top, get the combination?
    Code (csharp):
    1. InputSystem.AnyButtonIsPressed();
    2. InputSystem.AnyButtonWasPressedThisFrame();
    3. InputSystem.AnyButtonWasReleasedThisFrame();
    Systems that do "please press any button" are generally outside of the normal flow of the game (menu, demo booth version, special cutscenes), and having a system hooked up can be a bit of a drag. It's very convenient to just stick a behaviour in there that checks if
    Input.anyKeyDown
    , so the new input system having that in addition to the callback would make things easier.
     
    Deleted User, BTStone and NotaNaN like this.
  46. FireHawkX

    FireHawkX

    Joined:
    Apr 26, 2016
    Posts:
    28
    I was using version 1.0.2 and updated to version 1.1.1 today to get access to Save and Load BindingsOverrideAsJson method that was added in Experiemental Preview 3...

    However since the update, my move(vector2) isnt working anymore...
    If I press any keys, it always returns 0.0... if i dont touch the keyboard, it returns null

    (sprint, look, etc. all still works.. only the vector2 stopped working)

    I tried adding an "if" condition (see below in the screenshot), but now it only returns 0.0 no matter if i press any of the "Move" Keys or not...

    Any help or tips would be greatly appreciated!

     
  47. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
    @FireHawkX can you post you input action asset? likely something wrong about Move action itself
     
  48. FireHawkX

    FireHawkX

    Joined:
    Apr 26, 2016
    Posts:
    28
    Here is my actions input assets as requested :)
    hummm... unity doesnt allow for this type of file to be uploaded... (added to zip)
    I put both the MyActions.inputactions as well as InputSystem.inputsettings.asset since im unsure which is needed
    Let me know if i can assist with anything else or if you figure out what is wrong! :)
    (Especially since it was working absolutely fine before the 1.1.1 update)

    EDIT : I also tried making a new MOVE2 action set, mapping it to UHJK and trying it... but it had the same issue that all vector2 returned 0.0

    Thanks a lot for your time!
     

    Attached Files:

    Last edited: Oct 14, 2021
  49. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
  50. FireHawkX

    FireHawkX

    Joined:
    Apr 26, 2016
    Posts:
    28
    hahah YES my readvalue was indeed in the fixed update...

    I changed it to update... and its now working again.... wow... thanks for figuring that out!!!
     
    Last edited: Oct 15, 2021