Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Input System Freezes and Stops Registering Input

Discussion in 'Input System' started by SpiccyMayonnaise, May 4, 2020.

  1. NotaNaN


    Dec 14, 2018
    I was dumb too. I should have known that was the purpose of the quote. :oops:
    Sorry about that. :(
  2. Coloradete


    Sep 23, 2019
    Any news on this topic? I get this error too when loading a new scene on final builds and sometimes also in the editor, always when a new scene gets loaded. I'm using the InputSystem.EnhancedTouch to register swipe inputs
  3. GoodArcade


    Aug 7, 2013
    Hey devs! I've struggled with this for months and found a quick fix that worked for me. I went to Project Settings -> Other Settings -> toggled Active Input Handling to using only (New). I had it on "Both" before but after this change, I never had the problem again. Hope this helps inputfix.png
  4. Max_Bol


    May 12, 2014
    I'll join in as well since I just experienced the phenomenon of having a specific Input to always stop working for 3 secs around 1 sec after initiating the "Play" in the Editor.

    In my case, the only part of the input that wasn't working was "Position [Pointer]" as I use it to determine what's below the mouse in the game's scene. When the problem occurred, I did a lot of debugging to see whatever wasn't working while the input data wasn't updating in the editor.

    It ended up being a the Input System action specified above which was not updating its data returned with .ReadValue<>() while the problem was occurring. All the other inputs actions were working and updating properly.

    - The problem appeared after waking up the PC.
    - Restarting the editor made the problem go away.
    - There were nothing missing from the lists in the Input Debugging menu.
    - Active Input Handling is already set to "Input System Package (new)".
    - I haven't tried creating a built yet, so I can't comment on if the problem would persist through a build.
    - I'm currently using the latest version of Input System (1.0.2) and in Unity 2020.3-21f1 in DX11 mode (PC, Mac & Linux Standalone).
  5. Microman512


    Sep 19, 2019
    Hey all! I updated the Input System (1.3.0 > 1.4.4, I don't think the specific version matters) and close then re-opened my unity editor, and this issue seems to have gone away for me.
    I will note, the issue where my input doesn't work at all and i need to stop the game and press play again seems to happen more frequently. I'll update this if i find anything new.
  6. Deleted User

    Deleted User


    Thanks. I guess it solved mine too
  7. MarcGFJ


    May 16, 2019
    Still having this problem in Unity 2022.2.11 and ReWired on Windows 11. Using a specific mouse as well, Mad Catz Rat 8+. I can get this even while the game is idle in the editor, not even capturing the mouse, while I'm messing around in some other editor panel. Mouse freezes in place for 5 seconds, and in game `
    player.controllers.Mouse.screenPosition` just keeps reporting the same position all this time. And of course only happens when our game is running.
    This is also not only in editor, we had reports of players having this issue too.

    in ReWired we had "Native Mouse Handling" turned off. The problem still happens. It's random though, so we have difficulty figuring out whether some settings fix it or not. It's unclear if ReWired is causing it or if Unity is.

    Primary Input Source: DirectInput
    Use XInput: true
    Native Mouse Handling: false

    In Project Settings we still have Active Input Handling set to Input manager (old),will try the changing to New and see...
    Unfortunately doing this change isn't trivial for us because our game is already using `Input` in a bunch of places (GUI MBs notably, plugins...) in addition to ReWired... I don't know if there is any drop-in replacement for all these usages, but we're quite stuck
    Last edited: Oct 17, 2023
  8. guavaman


    Nov 20, 2009
    player.controllers.Mouse.screenPosition is a value that is taken directly from UnityEngine.Input.mousePosition regardless of whether Native Mouse Handling is enabled. If the rest of the game continues updating during this time, the Unity Update thread is not blocked and therefore Rewired is allowed to update and that means UnityEngine.Input.mousePosition is continuing to be polled, which means UnityEngine.Input is unable to get the mouse position.

    The mouse pointer freezing in place is indicative of something at the Windows level. An application freezing wouldn't cause the mouse pointer to freeze. Windows is in control of updating the pointer position regardless of what applications are doing (unless they're explicitly setting the pointer position through the Windows API, which Rewired does not ever do.)

    Whether the game continues updating or not during this freeze is extremely important to know. Code cannot be blocked on the main thread and have the application continue updating. If the game is continuing to update, that means the freeze is likely happening on another thread that is accessing some part of the Windows API.

    Another question would be, if the mouse is Bluetooth, does it also do this when connected via USB?

    With native mouse handling being false, there is absolutely no possibility that anything related to mouse in Rewired is responsible. It's simply just a wrapper for UnityEngine.Input at that point.

    The first thing I would do is to switch from Direct Input to Raw Input. Direct Input is extremely old. Rewired's Raw Input implementation supports more devices also. It is possible that simply using Direct Input function calls is causing some kind of interaction in Windows, especially considering you are using a 16,000 DPI mouse. High DPI mice did not exist when Direct Input was last updated. High DPI mice are known to cause problems with applications that don't read messages from the Windows event queue using buffered read. This is because so many events flood in that each read causes a mutex lock internally in Windows causing massive slowdown. Direct Input is closed source so there is no way to know how it interacts with other parts of the Windows API including how it reads events from the queue. Your intermittent issue doesn't exactly match the symptoms, but it's still suspicious.

    To completely rule out Rewired (including Direct Input), simply enable "Disable Native Input" in the Rewired Input Manager and test. This eliminates 100% of native code and makes Rewired nothing more than a wrapper for UnityEngine.Input. If it doesn't happen when that is enabled, then it would either be caused by something related to Direct Input, XInput, or windows device events.

    And then of course, there's the ubiquitous but rarely mentioned Steam which can easily inject it's own bugs into the stack for every input API. Also the mouse drivers could be involved in some kind of interaction with some Windows function or another. Update to the latest and or remove them to test. Also test lowering the DPI.

    Windows updates can and do bring with them new bugs related to input as well, so that's another potential variable to consider.
    Last edited: Oct 17, 2023
    Grigler_f likes this.
  9. MarcGFJ


    May 16, 2019
    The mouse is not Bluetooth, it is connected with USB

    I gave this a try, and so far it didn't freeze. Repro was random but hopefully that's the issue, because although my normal mouse is also a Rat, it doesn't have as much DPI as the one that we found reproduced the issue after a while.
    Thanks a lot for the insight.