End Game Collider

I want to create a game in unity3d. for that i need a collider script when a player touch a certain object the game will end or auto quit

using UnityEngine;
using System.Collections;

public class EndOflevel : MonoBehaviour {

	void OnTriggerEnter2D(Collider2D other)
	{
		Application.Quit();
	}
}

Attach this script to your gameobject that indicates the end of your level/game. Remove the 2D part of the names if you are using 3D colliders.