exit button doesn't close application

I’m trying to make a button based text rpg and i have a lot of questions the first being I made a menu for my game with a New game, load, save and quit button.

When i click the exit button, nothing happens, did i do it wrong?

`using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour {

// Use this for initialization
void Start () {	
}
// Update is called once per frame
void Update () {
}
void QuitGame () {
Application.Quit ();
Debug.Log("Game is exiting");

//Just to make sure its working
}

}`

You probably did nothing wrong, assuming your Debug.Log for exiting is actually being called.

Application.Quit doesn’t work in the editor, it only works in the finished build.

So if

Debug.Log("Game is exiting");

is actually causing an entry in your log you only need to build the game if you want to test the exit-button “for real”.

If you want to exit playmode in editor with this button, you can call:
Application.isPlaying = false;

making code:
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif

use this function
void QuitGame()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying=false;
#else
Application.Quit();
#endif
}