Input Error:"Fire1" button is unknown although it's written into Input Manager

My controller shows me this error:

UnityException: Input Key named: Fire1 is unknown
UnityEngine.Input.GetKeyDown (System.String name) (at C:/BuildAgent/work/7535de4ca26c26ac/Runtime/ExportGenerated/Editor/UnityEngineInput.cs:401)
Hit.Update () (at Assets/Scripts/Hit.js:6)

when i use this script:

function Update () {
  if (Input.GetKeyDown("Fire1")){
   Debug.Log("Ok");
  }
}

But the button “Fire1” is written correctly into the Input Manager…

It should be:

if (Input.GetButtonDown("Fire1")) {

Input.GetKeyDown() gets specific keys for the keyboard skipping the axes definitions in the Input manager.

GetKeyDown GetButtonDown…

Input.GetKeyDown(“Fire1”) doesn’t work.
Thank you. I had a painful time today. :slight_smile:

You need to go to> edit > projectSettings> input Manager and looking for Fire1 and format it to Fire 1. Making a little space between after that it will suppose to work : if (Input.GetButtonDown(“Fire 1”)){
}