Input Key is unknown?

I have an if statement that unlocks the cursor in one script, and opens the pause menu in another. The cursor unlocks, but the pause menu doesn’t open.

Both scripts use the exact same line:

if (Input.GetKeyDown ("cancel")) {

The exact error it gives me is:
3124892--236669--upload_2017-6-28_11-39-55.png

Any idea what’s wrong?

1 Like

Point me to a cancel key. I don’t have one.

3124897--236670--upload_2017-6-28_11-44-26.png

It works if I use the “KeyCode” one, but I really wanna find out why this one isn’t working.

It works now. I’m gonna assume it’s a bug.

But the console is still spammed with that error, and it’s coming from the first script (the one unlocking the cursor). Even though that one worked before, and still works.

“Cancel” not “cancel”

That doesn’t matter.

And just so you don’t say it does, I just changed it, and this time if says “Cancel” instead of “cancel” in the error.

EDIT: Doing “escape” instead of “cancel” works, don’t know why cancel doesn’t.

EDIT 2: Just tested it with another one, like “Horizontal” and that doesn’t work either… Shouldn’t you have to call the axes instead of their keys? Isn’t that the whole point of having the InputManager?

What if I have multiple keys set up? it won’t work for both of them this way.

You should be using GetButtonDown with the Input Manager, not GetKeyDown.

“Cancel” vs “cancel” absolutely matters in that case.

4 Likes

Oh, that’s what I was doing wrong. Thanks. :slight_smile: