So, I’m having a small problem (well, it’s pretty big to me) with my GUI button. I thought I had it scripted nicely, but it just won’t do what I expect it to do. I press the button, it does the sound I want it to, but nothing else. Here’s my script:
var selection : GUISkin;
var selectedMain : AudioClip;
var menus : int = 0;
var loadAvailable = PlayerPrefs.GetString("loadAvailable");
var turnabout = PlayerPrefs.GetInt("turnabout");
function OnGUI () {
GUI.skin = selection;
if (menus == 0){
MainMenu();
} else if (menus == 1){
ChapterSelect();
} else if (menus == 2){
Load();
}
}
function MainScreen () {
if (GUI.Button (Rect (75,375,250,40), "New Game").Play( selectedMain )) {
menus = 1;
}
if(loadAvailable == "true"){
if (GUI.Button (Rect (75,475,250,40), "Continue").Play( selectedMain )) {
menus == 2;
}
}
}
function ChapterSelect () {
if (GUI.Button (Rect (50,400,300,100), "Turnabout Beginnings").Play( selectedMain )) {
}
}
function Load () {
if (GUI.Button (Rect (50,375,300,40), "From chpt. start").Play( selectedMain )) {
}
}
Pretty much, I want the buttons to make other buttons appear while making themselves disappear. I thought using if statements would work, but what am I doing wrong?
Also, the Continue button is showing up even though it’s not suppose to. How would I fix that?