using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class MainMenu : MonoBehaviour
{
public Canvas quitmenu;
public Button exitbutton;
void Start()
{
quitmenu = quitmenu.GetComponent<Canvas>();
exitbutton = quitmenu.GetComponent<Button>();
}
public void exitpress()
{
quitmenu.enabled = true;
exitbutton.enabled = false;
}
public void nopress()
{
quitmenu.enabled = false;
exitbutton.enabled = true;
}
public void yespress()
{
Application.Quit ();
}
}
I found everytime i played the exit button would remove its self from the script component’s. I put it back will in play still nothing. Checked the function in the button component it was good, also the script component is on the canvas.