Holla ! i want to ask if what i do is aldy the right way of doing a popup?
i’ve been looking about popup for a while and found out this was right, but, i have a problem where, the Gui.button couldn’t click…
but GUI on the back of this one can clicked…
here is the image of what i mean.
see that blue box behind is the GUI behind it, if i click it, the brown box popup !
but now if i want to press the red x button, i the button won’t click… but i can only click the button behind them… is there any way to prevent this to happen? or does my way of popingup is wrong?
here’s my code for the entire GUI, it’s not much, so i will print all
#pragma strict
var buttonHealth : GUIStyle;
var buttonAttack : GUIStyle;
var buttonReward : GUIStyle;
var buttonTime : GUIStyle;
var popUp1: Texture;
var ispopUp : boolean;
var buttonOK : GUIStyle;
var buttonCancel : GUIStyle;
function Start () {
}
function OnGUI(){
if(GUI.Button(new Rect(Screen.width*0.5,Screen.height*0.1,Screen.width*0.4,Screen.height*0.2)," ",buttonHealth)){
print("a");
ispopUp=true;
print("b");
}
GUI.Button(new Rect(Screen.width*0.5,Screen.height*0.3,Screen.width*0.4,Screen.height*0.2)," ",buttonAttack);
GUI.Button(new Rect(Screen.width*0.5,Screen.height*0.5,Screen.width*0.4,Screen.height*0.2)," ",buttonReward);
GUI.Button(new Rect(Screen.width*0.5,Screen.height*0.7,Screen.width*0.4,Screen.height*0.2)," ",buttonTime);
if(ispopUp){
GUI.DrawTexture(Rect(Screen.width*0.3,Screen.height*0.3,Screen.width*0.5,Screen.height*0.5),popUp1);
GUI.Button(new Rect(Screen.width*0.5,Screen.height*0.3,Screen.width*0.1,Screen.height*0.1)," ",buttonCancel);
}
}