unity detect button input code example
Example: unity key detection
if (Input.GetKeyDown(KeyCode.Space))
{
print("space key was pressed");
}
if (Input.GetKeyDown(KeyCode.Space))
{
print("space key was pressed");
}