[SOLVED] ; Up arrow not responding to key press

After adding if statement :

if (Input.GetKeyDown(KeyCode.UpArrow)); {
print(“Up arrow pressed”);
}

warning statement CS0642: possible mistaken empty statement appears.
when I run program the up arrow responds like it is being pressed repeatedly but does not respond when actually pressed.

I have added a snippet of my whole code, the warning, and what the program looks like when running.



Hi Eric,

Remove the semi-colon you have before the opening curly brace on line 23.

It should read;

if (Input.GetKeyDown(KeyCode.UpArrow)) {
    print(“Up arrow pressed”);
}

Hope this helps.


See also;

Thank you Rob, can not believe I missed that!

1 Like

You are more than welcome, and don’t sweat it, easily done :slight_smile:

Privacy & Terms