csharp unity detect any keyboard input
Code Example - csharp unity detect any keyboard input
// Detect any keyboard input but not mouse input
private void Update()
{
if (Input.anyKeyDown && !(Input.GetMouseButtonDown(0)
|| !Input.GetMouseButtonDown(1) || !Input.GetMouseButtonDown(2)))
{
Debug.Log("No mouse pressed!");
}
}
unity check if key pressed
if (Input.GetKeyDown(KeyCode.KEY))
how to get keyboard input in unity
//https://docs.unity3d.com/ScriptReference/KeyCode.html - ALL KEYCODES