how to add a dialog box when quit is opted

when quit is opted i want a dialog-box to appear saying “are you sure you wanna quit. yes/no” if no is chosen then i want the game to quit other wise i want the game to resume.
how do i program it. i do not know much of programming.

please help


Go to gameobject => create other => 3dText.
Create the text you want and got to component=>physics=>boxcollider.
Make sure you text is not inside another object as it will show but you won’t be able to touch it.
Then assign that script below to the GUI object and you are good to go.

var GuiOn = false;
//Those 2 fcts are just to change the color of your word when you hover the mouse
over them
function OnMouseEnter(){
	renderer.material.color =;
function OnMouseExit(){
	renderer.material.color = Color.white;
function OnGUI () {	    	
        if(GuiOn){//check if gui should be on. If false, the gui is off, if true, 
        the gui is on
    		// Make a background box
    		GUI.Box (Rect (10,10,100,90), "You sure?");
    		// Make the first button. If pressed, quit game 
    		if (GUI.Button (Rect (20,40,80,20), "Yes")) {
    		// Make the second button.If pressed, sets the var to false so 
            that gui disappear
        		if (GUI.Button (Rect (20,70,80,20), "No")) {
        //fct checks for a click and sets the var to true to make gui appear.
        function OnMouseDown(){
        	GuiOn = true;

Now you need to start tweaking the variable to place properly and do exactly what you want.

Hope that helps