Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Keys getting stuck?

Discussion in 'Input System' started by mudloop, May 11, 2020.

  1. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,094
    Hi,

    I have a very simple setup. A couple of actions (of type "button") with default bindings, and no interactions or processors. I read the input with ReadValue<float> (), because that was easier to implement in my existing code than working with events. Currently no controllers are connected.

    Sometimes one of my buttons is returning 1f even though I'm not holding any keys. This mostly happens with my left button action. This action has left arrow, the "a" key, d-pad left and left stick left mapped to it.

    I noticed that it stops returning 1 after I tap the "a" key, so it seems like that's the one getting stuck for some reason. Tapping the left arrow doesn't unstuck it.
    Edit : confirmed - I added a sprite that shows when Keyboard.current.aKey.ReadValue () returns 1, and for some reason that sometimes happens when the key isn't pressed.

    It happens both in the editor and in builds. Mostly when the game gets focus again, but sometimes it happens as soon as I press any input.

    I have another button that sometimes fires (once) when I press any other button, but this happens less frequently.

    Here's how I initialize :

    Code (CSharp):
    1.         public static Controls controls;
    2.  
    3.         void Awake () {
    4.             if (controls == null) {
    5.                 controls = new Controls ();
    6.                 controls.@Player.Left.Enable ();
    7.                 controls.@Player.Right.Enable ();
    8.                 controls.@Player.Jump.Enable ();
    9.                 controls.@Player.Down.Enable ();
    10.                 controls.@Player.Dash.Enable ();
    11.             }
    12.         }
    Anything I'm doing wrong?
    I'm using Unity 2019.3.13f1 on Mac, and Input System v1.0.0 (published April 29).


    Also, when I connect my Pro Controller (both wireless and wired), it keeps spamming buttons. For instance, when I use the "listen" feature in Input System, the list is immediately filled. I've used this controller for games on my Mac (but only wirelessly), and it works fine with my Switch, so I don't think it's a faulty controller.

    Thanks!
     
    Last edited: May 11, 2020
    HumanCompiler and FIFTYTWO like this.
  2. btkal

    btkal

    Joined:
    Sep 2, 2018
    Posts:
    2
    I'm seeing the *exact* same issue. The fact that you seem to be the only person to report it (and me) yet it's so simple to reproduce makes me wonder if it's some kind of OSX issue? I'm on Catalina. I haven't tried running on Windows.

    This is with InputSystem 1.0.0 and Unity 2019.4.0f1.

    In my case it's firing the "left" event started/performed - which is incorrect - then not sending a canceled until I press it again, *and* reporting a "left" input when I directly query the action via ReadValue(). It was also happening both in the SendMessage and C# Events setup.

    and this is with basically the vanilla input system configuration when you create it.
     
  3. mudloop

    mudloop

    Joined:
    May 3, 2009
    Posts:
    1,094
    I'm still on Mojave, so it's not a Catalina-only issue. But might be a good idea to find some more common ground.
    I'm on a 2015 27" iMac, and I have a qwerty keyboard with numpad, and it's wired.

    For now I went with using the plain old input system for the keyboard, and InControl for controllers, and a custom solution for configuring actions. Works well enough, but it sucks that Unity still doesn't have a usable input system in place.
     
  4. btkal

    btkal

    Joined:
    Sep 2, 2018
    Posts:
    2
    I'm on macbook pro from about 4-5 years ago. Using the old Input for movement and new InputSystem for everything else works well as a workaround, thanks.

    for what it's worth I traced this back to https://github.com/Unity-Technologi...1761/Modules/Input/Private/Input.cs#L112-L126 and nothing in the call chain indicates it's anything but the callee of that function that has a bug, but unfortunately as far as I can find the Unity C++ code isn't open source so I can't debug further than that.
     
  5. jay3sh

    jay3sh

    Joined:
    Dec 30, 2013
    Posts:
    11
  6. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,549
    Hi @mudloop, if you haven't already, could you file a ticket with the Unity bug reporter? ("Help >> Report a Bug..." in the editor's main menu)
     
  7. Alex_May

    Alex_May

    Joined:
    Dec 29, 2013
    Posts:
    195
    I've just filed a report about this.
     
  8. Hiddenworlds225

    Hiddenworlds225

    Joined:
    Apr 18, 2017
    Posts:
    28
    Thank god this is a fresh thread, I thought it was an issue from long ago. I'll report my bug issue also. But it seems we all suffer the same thing.
     
  9. kristofferlundberg

    kristofferlundberg

    Joined:
    May 7, 2020
    Posts:
    3
    Same here! This also happend for me on the old input system so I though i'd migrate to the new system and see if the problem disappears. Sadly it didn't for me.

    I'm on a macbook pro 2015, Mojave.
     
  10. robertoalexis

    robertoalexis

    Joined:
    Sep 13, 2020
    Posts:
    1
    Same here. I'm using Unity 2020.1.5f1 running on Catalina 10.15.5. Input reports keys even when they are not pressed (I tried Input.GetKey() and Input.GetAxis() with the same results).
     
  11. mrdcturner

    mrdcturner

    Joined:
    Jan 28, 2013
    Posts:
    3
    Getting the same issue here - using left / right arrow keys and sometimes the left gets stuck.
    One workaround is to set the "Action Type" to value (I was previously using "Button").

    Hopefully that helps until the issue is properly addressed :)
     
  12. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    132
    I have the same problem, running Catalina 10.15.5 and in my case the left analogue stick registers up/left input suddenly during idle...
     
  13. losingisfun

    losingisfun

    Joined:
    May 26, 2016
    Posts:
    25
    Same here for all of the above and more. Me and my colleague running 10.13 up to 10.15 this seems to be a rampant problem.

    This mostly happens when you alt-tab during edit mode. Some inputs also get inverted, as in it thinks it's 'pressed' when it's not and not pressed when it is.

    Also if you try to use SHIFT + CMD + 4 and take a screenshot, once you take the screenshot it usually ends up putting one of the inputs into a forced 'pressed' state until you jiggle that input key.

    It seems to be localised to the editor. It doesn't seem to be a problem in builds, but haven't done as many tests.
     
  14. jcasalsl

    jcasalsl

    Joined:
    Oct 6, 2020
    Posts:
    1
    I have the same problem on Ubuntu 20.04
     
  15. HarrisonMcIntyre

    HarrisonMcIntyre

    Joined:
    Nov 12, 2020
    Posts:
    2
    Same problem on Windows 10.
     
    HumanCompiler likes this.
  16. geordiemhall

    geordiemhall

    Joined:
    Jun 6, 2020
    Posts:
    4
    Same problem here, where input will just start coming from a controller that's sitting idle on my desk. Usually it's the right stick (but occasionally with left stick and d-pad too).

    On macOS Catalina 10.15.7, Unity 2020.1.10 and InputSystem 1.1.0-preview2
     
  17. bobby2dazzler

    bobby2dazzler

    Joined:
    Nov 7, 2020
    Posts:
    2
    Same here on my first try with unity tutorials (lego minigame) - stuck 'left' from the moment I hit play.

    Windows 10, 2014.4.14f
     
  18. peterahou

    peterahou

    Joined:
    May 19, 2015
    Posts:
    53
    @Rene-Damm Any news on this? Did you get a chance to take a look at the issue? We're seeing it as well on both iOS and Android.
     
  19. Foreverlimbo

    Foreverlimbo

    Joined:
    Dec 6, 2020
    Posts:
    2
    Seeing the same thing on Unity 2019.4.15f1, Input system version 1.1.0-preview.2

    Anyone ever found a fix for this?
     
  20. peterahou

    peterahou

    Joined:
    May 19, 2015
    Posts:
    53
    @Foreverlimbo We ended up switching to Rewired. It's $45 on the asset store and fixed all our problems. Definitely recommended until Unity sorts our their input system (or buys and integrates something like Rewired).
     
  21. Foreverlimbo

    Foreverlimbo

    Joined:
    Dec 6, 2020
    Posts:
    2
    Cool! For some reason, I think this is just a bug in the building of the project since when I remade the project it was all fixed. But thanks anyway, I've heard rewired is really good
     
unityunity