Hello Unity Answers,
I have created a main menu, and the problem I’m having is when I click either Instructions or Exit text/button both pop up boxes appear instead of If I clicked Instructions, then the UI image on the left appears and if I click Exit the UI image on the right appears. .
All ideas, help, suggestions welcome.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class menuScript : MonoBehaviour {
public Canvas quitMenu;
public Canvas instructionMenu;
public Button startText;
public Button instructionText;
public Button exitText;
// Use this for initialization
void Start ()
{
quitMenu = quitMenu.GetComponent<Canvas> ();
instructionMenu = instructionMenu.GetComponent<Canvas> ();
instructionText = instructionText.GetComponent<Button>();
startText = startText.GetComponent<Button> ();
exitText = exitText.GetComponent<Button> ();
quitMenu.enabled = false;
instructionMenu.enabled = false;
}
public void ExitPress()
{
quitMenu.enabled = true;
instructionMenu.enabled = true;
startText.enabled = false;
instructionText.enabled = false;
exitText.enabled = false;
}
public void NoPress()
{
quitMenu.enabled = false;
instructionMenu.enabled = false;
startText.enabled = true;
instructionText.enabled = true;
exitText.enabled = true;
}
public void StartLevel()
{
Application.LoadLevel (1);
}
public void ExitGame()
{
Application.Quit ();
}
}