How to check if the pressed key is different than the expected key ?

I’m looking for something like this:

A letter appears and the player has to pressthe right key

X appears on the screen > Player has to press"X"

But if the player doesn’t press the right key, he loses.

I tried:

if(Input.GetKeyDown() != keycode) { “do something” }

but it doesnt seems to work :confused:

I didn’t find any informations about this features, does anyone has a suggestion ? ^^

Maybe it’s better if you do

if(Input.GetKeyDown(KeyCode.X))
{ "Do something when player pressed right key" }
else
{ "Do something when player pressed wrong key" }

I’m not sure if Input.GetKeyDown() works as you’ve done it, but try it as I’ve wrote.

In this case “else” include not pressing the right key, but also just do nothing…