- Home /
Question by
acesouthall · Feb 06, 2014 at 09:45 PM ·
buttonmenuoverlapoverlay
Back button on menu to go back to previous menu screen
I am developing the menu of a game and on each screen there is to be a settings button.
I have a default settings screen but the back button leads to the main menu.
I have my menu all in the same screen at the moment but I plan on putting it into separate scripts for easy management. With having separate scripts is there a way to call a menu script so that it overlays the current menu and then the back button would remove the script.
At the moment I have it so that the settings menu overlays the current menu but the current menu is still on top of the settings menu. I've tried changing the ordering in the inspector view but with no improvement.
Settings menu: using UnityEngine; using System.Collections;
public class TestMenu : MonoBehaviour {
public Texture background;
void OnGUI()
{
GUI.Box (new Rect(0,0,Screen.width, Screen.height), background);
// Back button
if (GUI.Button(new Rect(Screen.width - 200, 200, 200, 200), "TEST BUTTON"))
{
gameObject.GetComponent<TestMenu>().enabled = false;
}
}
}
Comment