Make the UI close when you click a button.

I am new to Unity 5, and I have started on using UI to make a main menu. I have made a button that will end the exe program, and will close the application (It says “EXIT”), but I have another button that says “PLAY”, and i want it to close the UI, so there is no overlay. This is what i have so far:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class menuScript : MonoBehaviour
{

public Canvas quitMenu;
public Button startText;
public Button exitText;

public void ExitGame ()
	
{
	Application.Quit();
	
}

public void StartGame ()

{

}

You could just disable the gameobject with your UI beneath it:
gameObject.SetActive(false);

if you are using Unity new GUI system, you can do that close feature without adding script. You select the “PLAY” button. In inspector, there should be a section “onClick”. Click “+”. Link it to the gameobject you want to hide, and selection the function GameObject->SetActive in there.