How to: Press (A) to restart, (B) to quit (GamePad)

I did research but can’t find what I need, and it seems simple maybe? At the end of my game I want to be able to have the player either press A to restart the game, or B to quit application. (On the GamePad) I have an ending scene and will have some text that tells them this also. I don’t need any Hover script. Just something like: (This is sample code) I have no idea what function I would actually need to use and if this is even close to being right.) Anyone have any ideas or can direct to me to a post they know of?

function Update () {
	if (Input.GetButton("joystick button 0"); LoadLevel(0);
	if (Input.GetButton("joystick button 1"); QuitApplication;
		
		
	}

Couple things:

  1. Your if statements need parenthesis, not semicolons

  2. In Edit > Project Settings > Input you define the joystick keyboards and name them with a string, typically Fire1 and Fire2 are the defaults. Use that for a GetButton check.

  3. Application is the base class for changing scenes or quitting the game. See Unity - Scripting API: Application for more info.

    function Update () {
    if (Input.GetButton(“Fire1”))
    Application.LoadLevel(“YourSceneName”);
    if (Input.GetButton(“Fire2”))
    Application.Quit();
    }