how do i launch the game with input?

I want to make it so pressing 1 starts the game and 2 quits it. How do I do that?

Use Input.GetKeyDown:


if(Input.GetKeyDown(KeyCode.Alpha1)||Input.GetKeyDown(KeyCode.Keypad1)){
//start game code
}
if(Input.GetKeyDown(KeyCode.Alpha2)||Input.GetKeyDown(KeyCode.Keypad2)){
//quit game code
}

I think Input.GetKeyDown("1") should work too.