I’ve been trying to display a screen which shows the character’s information, and if you click on a certain button, it moves to the next screen. However, when I click on the button, both boxes end up showing, but if you click again then it goes away.
Here’s my code:
function OnGUI(){
if(showCharacterInfo == true){
GUI.Box(Rect(Screen.width-260,Screen.height/2-125,250,250), "Character");
if(GUI.Button(Rect(Screen.width-93, Screen.height/2+92, 80, 30), "Stats")){
showCharacterInfo = false;
showStats = true;
}
}
}
Any explanation for why this happens?