Search Unity

Keyboard and all input suddenly stopped working?

Discussion in 'Scripting' started by Desprez, Feb 24, 2017.

  1. Desprez

    Desprez

    Joined:
    Aug 31, 2012
    Posts:
    305
    Suddenly, none of my scripts are responding to any inputs at all. Not keyboard, not mouse.
    I made a slight tweak in one script, but then changed it back. Nothing. And not all of the scripts that stopped working had been changed.

    I don't see anything obviously wrong, across multiple scenes.

    I used Debug.Log to make sure the code was executing in Update(). It is, but it's not getting any detection of input.

    I tried restarting Unity. Nothing. I don't know what happened.
     
    AldeRoberge likes this.
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    You're certain that the Game window is focused when you're playing?

    Can you paste the code you're using for input? It doesn't sound like it's code-based, but if you're doing something weird, it's possible.

    Have you tried creating a new project with a new script that just tests input?
     
  3. Desprez

    Desprez

    Joined:
    Aug 31, 2012
    Posts:
    305
    Yes, window is focused.

    Ok, I just tried one of the scripts in a new project.
    It works there.
     
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    So, your project got corrupted somehow. Check Edit -> Project Settings -> Input and make sure it still has all the axes/buttons set up there. If not, then I'm guessing the settings file got corrupted somehow.

    Maybe grab your new project's ProjectSettings/InputManager.asset file and copy it to your existing project folder in the same place? (close Unity while you do that just to be sure it takes)
     
  5. Desprez

    Desprez

    Joined:
    Aug 31, 2012
    Posts:
    305
    Well, it suddenly started working again. Dunno why, I didn't do anything.
     
  6. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    408
    This happens to me a fair bit - resizing the window makes it work again
     
    suinext likes this.
  7. DevJim

    DevJim

    Joined:
    Dec 23, 2013
    Posts:
    26
    Just wondering if anyone found more info on this? Happens to me every hour but minimizing or resizing usually fixes it.
     
    AeOngDev, honor0102 and nekitmesniov like this.
  8. CavernHead

    CavernHead

    Joined:
    Mar 30, 2017
    Posts:
    10
    Happend too me too. everything except mouse left and right click stoped working. Restarted unity and then everything went back to normal.
     
  9. bianolacerda

    bianolacerda

    Joined:
    Sep 21, 2018
    Posts:
    4
    All of a sudden, keyboard and all input stopped working here too. I can't fix it!
    Restarting doesn’t work. Neither reinstalling Unity worked.
     
  10. dohyung97022

    dohyung97022

    Joined:
    Jul 25, 2018
    Posts:
    3
    Resizing or restarting did not work, but starting by the unity made shortcut in the desktop worked. Do not open by the scenes shortcut.
     
  11. DevJim

    DevJim

    Joined:
    Dec 23, 2013
    Posts:
    26
    Still happens over here, are we all using steamworks/ the steam overlay by any chance?
     
  12. johndalzell671

    johndalzell671

    Joined:
    Oct 15, 2018
    Posts:
    3
    I am having same problem Suddenly keyboard appears dead. Is this a Unity issue or my project file? Okay so I installed an older version of the engine and opened a new project ... Still nothing!

    ... I opened new scene and tried 3d person controller and it worked fine But vehicle does not .. Purchased a new vehicle controller and it also does not work.

    Any ideas?
     
    Last edited: Nov 27, 2018
  13. DevJim

    DevJim

    Joined:
    Dec 23, 2013
    Posts:
    26
    If you hover over unity in the taskbar and wait for the window preview to appear, right click on the window preview and hit maximize. It may take one or two attempts but this generally fixes it, if it's the same issue.
     
  14. johndalzell671

    johndalzell671

    Joined:
    Oct 15, 2018
    Posts:
    3
    Didn't help. Bought the NWH vehicle physics and the demo works fine But not the prefab nor the vehicle in standard assets 2 days ago standard assets vehicle worked just fine
     
  15. bianolacerda

    bianolacerda

    Joined:
    Sep 21, 2018
    Posts:
    4
    [SOLVED] For me, it was because I had accidentally deleted Event System from Scene and Graphic Raycaster (component) from UI Canvas. By restoring those items keyboard and mouse are functioning again.
     
  16. DataSmith2112

    DataSmith2112

    Joined:
    Mar 1, 2018
    Posts:
    2
    This just happen .. Funny part is I did almost everything listed here as what may have caused it ..
    None of the advice helped sorry to say. I just made a new project and copied over my assets folder.
    A few script inputs didn't copy over to the new project. Scripts was there just not loaded in project ... Hmm.
    But I was able to run 2 Unity editors and copy over what was missing by hand. Now ... back to work!
     
  17. jandd661

    jandd661

    Joined:
    Jun 25, 2017
    Posts:
    23
    Just happened to me too. Nothing seemed to work to fix it. Had to do "Export Package" in the broken project. Then create a new project and import it. All is working again. :confused:
     
  18. devilhunterxl

    devilhunterxl

    Joined:
    Dec 19, 2018
    Posts:
    14
    Oh geez, it happens from time to time. I use Unity 2018.3.13
     
  19. abdullaa

    abdullaa

    Joined:
    Jul 4, 2019
    Posts:
    1
    Same for me, have you got any luck?
     
  20. bianolacerda

    bianolacerda

    Joined:
    Sep 21, 2018
    Posts:
    4
    Yes. See my post on Nov 20, 2018 ;)
     
  21. bianolacerda

    bianolacerda

    Joined:
    Sep 21, 2018
    Posts:
    4
    Yes. See my post on Nov 20, 2018. ;)
     
  22. fabiopicchi

    fabiopicchi

    Joined:
    Jan 22, 2016
    Posts:
    22
    The scary thing for me is that whenever the keyboard stops working inside unity, it stops working in my game already deployed to itch io. My only fix is to restart the computer hahahaha
    Gamepad seems to be working just fine though...

    On a side note, I am using the new input system.
     
    kobozev likes this.
  23. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    I'm also using the new input system and suddenly got problems on one of my computers but not the other. Seems like the new input system does not process input events suddenly on that one. I checked the debug window and the devices send their input just fine. Tried jumping back and forth in repo history does not seem to help, neither does restarting.

    EDIT: Update of windows fixed it
     
    Last edited: Sep 27, 2019
  24. Uppset_Dave_

    Uppset_Dave_

    Joined:
    Oct 20, 2019
    Posts:
    1
    I'm having this issue still, i'm on Linux, when I run a demo in the minimised window it works fine but when I do it in a maximised window it doesn't even budge!
     
  25. centaurianmudpig

    centaurianmudpig

    Joined:
    Dec 16, 2011
    Posts:
    92
    +1 for having this issue.
     
  26. MrGreenish

    MrGreenish

    Joined:
    Oct 20, 2019
    Posts:
    34
    If you are having this issue. Have you installed a anti-key logger like Ghostpress? In that case you need to add Unity as an exception.

    Most of my keys where blocked both in edit mode and play mode but the arrow keys and the mouse could still be used.
     
  27. bas-interactive

    bas-interactive

    Joined:
    Aug 24, 2019
    Posts:
    2
    I think this is a Unity bug, because when I exported it as a standalone, everything was fine o_O
     
  28. ClearRoseOfWar

    ClearRoseOfWar

    Joined:
    Sep 6, 2015
    Posts:
    89
    I was having the same issue for a bit. I had recently imported an asset from the asset store, (Joystick Pack) and when I went to play and test out the joystick, my keyboard controls had stopped working.

    [My Solution / Error]
    I suppose While setting up my unity remote with my pc, I must have changed 'Joystick Source' from local to remote. Setting the 'Joystick Source' to Local made things work again. Project Settings -> Editor -> Joystick Source.
     
    jordifzr and Ghosthowl like this.
  29. VaccionesMad

    VaccionesMad

    Joined:
    Apr 17, 2014
    Posts:
    4
    Necromancing this thread, I'm having an issue with deviced detection.

    The input system is working dandy with keyboard and mouse but now isn't picking up any events or inputs from gamepads.

    Anyone would know why? Thanks.
     
    ryzeonline likes this.
  30. ryzeonline

    ryzeonline

    Joined:
    Feb 10, 2020
    Posts:
    27
    I have similar issues to posters above.


    Input works fine in editor, game-view, maximize-on-play, etc.

    But when I run my standalone build and press a key to open my UI, suddenly all keyboard input is frozen / ignored. Would love some help or pointers in the right direction. :/
     
  31. Lz_Yahya

    Lz_Yahya

    Joined:
    Jan 24, 2020
    Posts:
    7
    Same problem here my Input.GetMouseButtonDown(0) works fine but for the keyboard input None of them work ,Any Solution Guys ??
     
  32. Lz_Yahya

    Lz_Yahya

    Joined:
    Jan 24, 2020
    Posts:
    7
    [SOLVED] Yo Guys For my Case the Problem was the UNITY REMOTE 5 when i was attached to my project i didn't get no Input from my Keyboard ,But when i detached my phone and Reopen Unity it works Really Fine.
     
  33. makhot

    makhot

    Joined:
    Dec 6, 2015
    Posts:
    1
    I was struck with the same issue when updating my project to Input System 1.0.0. Everything else (gamepad, accelerometer) seems to work but keyboard is dead.

    Input debugger shows that keyboard registers just fine, but Input System doesn't fire any events with keyboard. I tried the above window sizing tips, removing and adding keyboard again from project settings of Input System. No help.

    I noticed that if I remove keyboard bindings from Actions I cannot add them again. I couldn't be arsed to try completely deleting the Input System settings though to test if they got somehow corrupted.

    So I couldn't solve the issue and had to start using old Input Manager for keyboard, luckily I'm developing for mobile, but very annoying nevertheless.
     
  34. Zer0Cool

    Zer0Cool

    Joined:
    Oct 24, 2014
    Posts:
    203
    One possible solution:
    Check if "Time Scale" in the "Time" project settings is 0. Because then the Input class doesnt reports any player inputs.
     
    brian-nielsen and Fibonaccov like this.
  35. unity_bfvNwgs4mDhzgw

    unity_bfvNwgs4mDhzgw

    Joined:
    Apr 22, 2020
    Posts:
    5
  36. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    130
    I got the same problem right about now, too.

    Two whole days trying to figure out what the eff I did wrong.

    I had two "Player Input" components in my scene.

    I disabled one and yeeted it out to the sun.

    Everything works perfectly.
     
    stefanbendrin and kKarthus like this.
  37. ObaiAlashkar

    ObaiAlashkar

    Joined:
    Apr 15, 2020
    Posts:
    1
    I had the same issue. When Restarting, I Made Sure Unity Hub was Closed. Then it worked!
     
  38. laultman

    laultman

    Joined:
    Jul 12, 2020
    Posts:
    17
    I have this issue. Unity crashed with a mis-configured XR SDK. Since then mouse and keyboard work normally everywhere except in the Player mode. No ASDW or mouse click right or left, and the spacebar and shift keys do not cause the hands to appear. Reverted to known good projects and they also do not work now. Have uninstalled/reinstalled Unity, rebooted the computer, and tried several known good projects with no results. I have tried resizing Unity, player, changed displays, clicked the game play tab. I am not running any custom scripts.
     
  39. ak2286658

    ak2286658

    Joined:
    May 30, 2020
    Posts:
    2
    Worked for me :)
     
  40. Reshima

    Reshima

    Joined:
    Dec 10, 2012
    Posts:
    51
    Worth mentioning that if you're using the Device Simulator package, keyboard/mouse/controller input won't work in the Simulator view, only the Game view. upload_2020-9-10_22-56-16.png
     
    AjayDas likes this.
  41. laultman

    laultman

    Joined:
    Jul 12, 2020
    Posts:
    17
    I have not tried the XR plugin again, but all my issues have been related to documentation and the ARM64 compiler bug.
     
  42. jakkebob55

    jakkebob55

    Joined:
    Sep 22, 2020
    Posts:
    1
    idk maybe b e a n s will help
     
  43. mjc33

    mjc33

    Joined:
    Oct 9, 2019
    Posts:
    26
    I had this issue using the new input system package when upgrading to a new 2020.2 beta version, check the project player settings that "active input handler" hasn't been reverted to the old input system during the update
     
    lumbryga likes this.
  44. lumbryga

    lumbryga

    Joined:
    Feb 28, 2018
    Posts:
    7
    My problem was after checking out to an old Git branch which did not use the new Input System yet. I just had to restart Unity after changing branches. mjc33's tip helped a lot, as well!
     
  45. Fibonaccov

    Fibonaccov

    Joined:
    May 5, 2020
    Posts:
    58
    Holy molly! Thank you! Not sure how this ever got put to zero to be honest - I may have experienced with an asset which did however - unbelievable! remains a mystery but at least I can now resume work! Cheers
     
    brian-nielsen likes this.
  46. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    78
    I'm having this as well. I think it started around moving to 2021.1
    When it happens I need to replay about 3 times and then it seems to work until next restart. Never seen it in a build though..
     
  47. hellingelijahhelling

    hellingelijahhelling

    Joined:
    May 21, 2021
    Posts:
    1
    if you save and quit and come back it works fine
     
  48. Gramatik1

    Gramatik1

    Joined:
    Oct 4, 2021
    Posts:
    1
    Just save the project and restart Unity, enter the project again and everything works fine
     
  49. kloot

    kloot

    Joined:
    Mar 14, 2018
    Posts:
    78
    The easiest solution I found is to give focus to another app and then back to Unity.

    EDIT:
    In my case (I'm on Windows), I figured out that this happens if I hit the shortcut for playing while the mouse cursor is over a window like Hierarchy or Project, and the shortcut is something that that window has registered (such as the F key). In these cases, the shortcut isn't bubbled up to the game window for some reason.
     
    Last edited: Jan 5, 2022
  50. unity_36B0BFA05DEFE5974404

    unity_36B0BFA05DEFE5974404

    Joined:
    Dec 1, 2021
    Posts:
    1
    Okay so I what did was I deleted and reinserted my input module. Then if that didn't work inside the input module made sure I was using the right controls, for whatever reasons my controls switched in the game.