how to get a key oress unity code example
Example 1: unity key detection
if (Input.GetKeyDown(KeyCode.Space))
{
print("space key was pressed");
}
Example 2: onkeypressed unity
public void Update()
{
if (Input.GetKeyUp(KeyCode.X))
{
//do stuff
}
}