- Home /
Keyboard input not working
One day, when I got on to Unity, I tried to test my project out in the Editor. Everything worked fine- Except for the fact that suddenly, none of my inputs were working. To test if this was some other part of my code, I added a snippet which prints a message whenever I give a certain input in Update().
I found a problem exactly like mine, with no clear problems in the code. I think whatever was wrong with this guy's Unity is wrong with mine, and I have no idea how to do what he did. Honestly, I just need to know how to get to the Input Registry he mentioned.
http://answers.unity3d.com/questions/372239/basic-keyboard-input-not-working.html
I am almost certain the problem is not in my code, but if somebody thinks I'm wrong, tell me.
if(Input.GetButtonDown("Interact") && distance < maxdistance){
AddItem();
}
EDIT: In the AddItem function, I have Debug.Log("Added Item!"). Just so people know.
Have you made sure your Input Setting(under Edit - Project Settings) name is called "Interact" for the button you want to trigger this action? You prob have but worth a double check for typo's. Are you pressing any other keyboard keys at the same time, there is a bizarre thing to do with how keyboards are physically wired which stops button recognition if more than three are pressed simultaneously(It does depend on which buttons but the direction arrows are affected on my keyboard).
Thank you for commenting! I have checked for typos, and there are none I can see. I got my keyboard with my new desktop, and one of it's features is Anti-Ghosting. (Just in case you are wondering, the "Interact" input is bound to E).
I never knew it was called Ghosting, thanks! as for the fix I'm stumped, sorry.
Put this code in and see what, if anything, pops up in your debug window.
if (Input.GetButtonDown("Interact")) {
Debug.Log("Button press is working");
if (distance < maxdistance) {
Debug.Log("Distance check is working");
AddItem();
}
}
I tried to use that code in the script, but still, nothing happens. D:
Then I am truly at a loss for how to fix this. Sorry I can't be more help. Anyone out there got any ideas? Have you put a Debug.Log before this code to check that you are getting to this point, my last hope of being any help to you.
Answer by Bunny83 · Oct 15, 2014 at 02:15 AM
Well, if you are sure that:
You defined a virtual axis called "Interact" ...
Your "distance" is indeed smaller than "maxdistance" ...
You're executing this if-statement inside Update of an enabled script on an active GameObject in the scene while you're in play-mode ...
...then... i have no idea.
I've checked my registry if that key exists (Win 8.1) but the there is no "Input" key under that path. If you want to check your registry, just press Win+R and type "regedit". Navigate to the path mentioned in the post you've linked (`HKEY_CURRENT_USER\Software\Unity\UnityEditor`) and check if there is a string value called "Input".
On my PC there's only one string value and it's called "Editor StatsDone" which is set to the string "yes".
(ps: Just in case you didn't know, don't mess up anything in the registry or you might nuke your system, at least if you don't know what you're doing ;) I strongly suggest to create a system restore point ;))
Thank you so much for the feedback! I checked out my registry, and I did have a listing there. I deleted it, and everything works fine now! :D
Just googled around and it seems that in the past (< Unity 3.5) Unity had problems using some game controllers. Inserting that reg-key forces Unity to use DirectInput (the input wrapper from DirectX). However since Unity 3.5 this key seems to completely break the input. Usually some developers just "suggest" that their customers should add this reg-key, but it looks like there are some developers that just set this key on their own. $$anonymous$$aybe you have played one of these Unity games and that key got set. Usually it doesn't exist.
Hello :!!!
I have the same problem..... i try to learn Unity but during the tutorial "ball collecting object"... and after second chapter, I just realize that my keyboard dont control anything.... the script i wrote for moving the ball is good but there is just no reactions when i launch the scene..... I try to take a look at my registry following your advice and i have two line in the unityEditor folder : "Editor Statsdone" and "(par défault)" Doesnt seems to be the "listing" oooooooooooottt and bunny83 were talking about.....
Also another info : i have install an older version of Unity 4.3.4 for another tutorial learning.... and the keys are working !!!! HELP §§ I A$$anonymous$$ So lost..... it's working with the 4.3.4 but not with the 5.4.1
Answer by alexander11 · Oct 14, 2014 at 11:34 PM
you can go to Edit/Project Settings/Input in unity thats were all your inputs are. have a look at em maybe it have reset and stuff if that doesn't work make a new project see if that helps.:D :D
Answer by Benjanak · Oct 20, 2016 at 09:12 PM
Hello :!!!
I have the same problem..... i try to learn Unity but during the tutorial "ball collecting object"... and after second chapter, I just realize that my keyboard dont control anything.... the script i wrote for moving the ball is good but there is just no reactions when i launch the scene..... I try to take a look at my registry following your advice and i have two line in the unityEditor folder : "Editor Statsdone" and "(par défault)" Doesnt seems to be the "listing" oooooooooooottt and bunny83 were talking about.....
Also another info : i have install an older version of Unity 4.3.4 for another tutorial learning.... and the keys are working !!!! HELP §§ I AM So lost..... it's working with the 4.3.4 but not with the 5.4.1
Your answer

Follow this Question
Related Questions
Prevent unity hotkeys in editor 0 Answers
Does the Unity editor support touch input? 1 Answer
mouseposition and clicks in editor sceneview 0 Answers
[Unity Editor] Emulate Touch Input - Still Asking 12/10 1 Answer
rotate with alt doesnt work 15 Answers