how to detect any press of a key unity code example
Example 1: unity detect any key
if (Input.anyKey) {
// Code here
}
Example 2: unity key detection
void Update()
{
if (Input.GetKeyDown("space"))
{
print("space key was pressed");
}
}