unity detect if keyboard button is down code example
Example 1: unity check if key pressed
if (Input.GetKeyDown(KeyCode.KEY))
Example 2: unity check if right keyboard button is down
void Update()
{
// Do stuff when the spacebar is pressed:
if(Input.GetKeyDown(KeyCode.Space))
{
// Do stuff
}
// Do stuff when the spacebar is held down:
if(Input.GetKey(KeyCode.Space))
{
// Do stuff
}
}