- Home /
button "w" is not setup error
hello fellow creators, i make games all the time and if i needed a key input i use if(Input.GetKeyDown("w")) and it worked allways fine. in my last project i made a simple playercontroller using this method. i created another script for anothr object where i wanted to do something on w pressed. again i used if(Input.GetKeyDown("w")) but it showed up the error that the button w wasnt assigned. i know i can just asign the button to an sertain action but i just want to use the easy other way where u could just type the letter as always. the only thing that i did between making the first and the second script was adding animations to the player... but i dont think that has something to do with it.
if you know a solution pls help me.
thanks,
Don't know what's going on there but have you tried using the $$anonymous$$eyCode version of Get$$anonymous$$eyDown ins$$anonymous$$d?
https://docs.unity3d.com/ScriptReference/Input.Get$$anonymous$$eyDown.html
i have actually, also i copied and pasted the if statement tof the code in your link. i added a simple debug.log("space is pressed"); but it still says that space s not setup. thanks for the reply btw
Answer by florivault · Nov 25, 2018 at 03:35 PM
maybe, check : edit>project setting>Input
And if it's still working in the other project one could try comparing its settings with those of the broken project.
Here is the weird thing.... its all in 1 project. and florivault i allready did, thanks
Answer by Nackles42 · Nov 25, 2018 at 08:40 PM
You want to use Input.GetKey if you're going to call it by W. If you want to use Input.GetButton, you need to use the name in Edit>Input like Fire1, Jump, Submit, Cancel, etc.