function OnGUI()
{
if(isWrong)
{
GUI.Window(0, Rect((Screen.width/2)-90, (Screen.height/2)-190, 300, 150), showGUI, "Sorry!!");
}
}
function showGUI()
{
if(isWrong)
{
// You may put a label to show a message to the player
GUI.Label(Rect(65, 50, 200, 80), "Boo..Boo.. WRONG WORDS!!!");
}
// You may put a button to close the pop up too
if (GUI.Button(Rect(60, 90, 75, 30), "OK"))
{
isWrong = false;
}
}
this is my code. I don’t understand how come when i click on ok, the window are not closing??
var isWrong = false;
function OnGUI()
{
if(isWrong)
{
GUI.Window(0, Rect((Screen.width/2)-90, (Screen.height/2)-190, 300, 150), showGUI, "I'm Sorry!!");
}
}
function showGUI()
{
if(isWrong)
{
// You may put a label to show a message to the player
GUI.Label(Rect(65, 50, 200, 80), "Boo..Boo.. WRONG WORDS!!!");
}
// You may put a button to close the pop up too
if (GUI.Button(Rect(60, 90, 75, 30), "OK"))
{
isWrong = false;
}
}
Sorry everyone, as my code is very very long. So was quite blur in which code i should show. My mistake. I did change the value. Just can’t figure out where gone wrong…