private var logintext : String = "Your Name";
function OnGUI ()
{
logintext = GUI.TextField (Rect (100, 40, 150, 20), logintext, 14);
if (GUI.Button (Rect ( 20, 10, 80, 30), "Connect"))
{
if (logintext == "")
{
GUI.Label(Rect(200, 200, 100,50), "Text Here"); // Script reads this line, but this command isn't working.
// If i use another command like Print. It is working but GUI isn't
}
}
}
I don’t know why it’s not working. Every command is working except GUI.
Please help me
the label will only show when you click the button, you won’t event see it appear on screen.
use a boolean to show the label on screen and switch the boolean with the button
because the time the button is clicked is 1 frame, so the label only shows during that frame. the time is to short to actualy see the label on the screen. once the frame has finished, the button isn’t in a click state anymore and the label is removed from the screen.