- Home /
Other
Keyboard and mouse inputs not working
Followed a tutorial and the following if statement does not produce any result in the console
if (Input.GetKeyDown(KeyCode.UpArrow)) Debug.Log("Up Arrow key was pressed");
Tried changing the input key to a mouse button but still wouldn't work.
Cheers
Can you copypaste the surrounding code? Is it inside Update function? Is the script loaded into game hierarchy, ie attached to a gameobject?
Answer by BladeSides · Jun 17, 2020 at 03:48 AM
Are you sure you clicked inside the Game Window? It doesn't recognize any inputs unless you are inside the Play Window and focused onto it (by clicking on it once).
Be sure to move from scene view to game view, which can be added from layouts if you removed it by mistake.
I am clicked in on the game window displayed by the blue bar above the game window and it isn't working :(
Follow this Question
Related Questions
Enter/Exit Vehicle with the same key? 2 Answers
Input.GetKeyDown doesn't work with several keys 1 Answer
Why is GetKeyDown returning false when provided with string from .inputString? 2 Answers
GetKeyDown Problem 3 Answers
Enter not being called 2 Answers