Exit from Splash screen

This is the script I wrote to load my exit splash screen when “Escape” button is down. I’m trying to get the program to close or quit after the splash scene is done. The Application.Quit isn’t working. Im running this as PC,Mac Standalone.

using UnityEngine;
using System.Collections;

public class Scene2Exit : MonoBehaviour {
public float delayTime = 12;

	// Use this for initialization
	void Start () 
	{

	}
	
	// Update is called once per frame
	void Update () 
	{
		if (Input.GetKeyDown (KeyCode.Escape))
			Application.LoadLevel (3);
		{
			if (Input.GetKeyUp (KeyCode.Escape))
				Application.Quit ();
		}

	}

}

when the new scene is loaded, your script is unloaded.
You need to had a script to your splash screen scene with only

if (Input.GetKeyUp (KeyCode.Escape)) Application.Quit ();

in the Update function.

but if the user do this too fast it may have a weird behavior. What you should do is quit after a Coroutine, still in a script in a splash scene :

    void Start(){
    StartCoroutine(Wait(time));
    }  

    IEnumerator Wait(float waitTime) {
            yield return new WaitForSeconds(waitTime);
            Application.Quit();
    }

Thanks for the reply applemaniac,

I did finally get this to work by adding the script below to the game environment scene. Level (1) is the splash scene.

void Update () 
	{
		if (Input.GetKeyDown (KeyCode.Escape))
			Application.LoadLevel (1);	

	}
}

Then I added this script to the exit splash scene (Level 1).

public class Exit : MonoBehaviour {
public float delayTime = 10;

	// Use this for initialization
	IEnumerator Start () 
	{
	yield return new WaitForSeconds( delayTime );
		Application.Quit ();
	}
	
	// Update is called once per frame
	void Update () 
	{

		}

Now when I hit “Esc” it goes to the exit splash scene and the update waits the 10 second delay and quit application. I think the way I did it is the amateur way to do it and I will definitely try your suggestion. So do I add your script to the game scene or the splash scene?