getting stuck with GUILayout

Hi,

I am a new user. I was trying the GUILayout concept but it wasnt working. My Code is as below:

var signin:boolean= false;
var signup:boolean= false;
function OnGUI () 
{	
GUILayout.BeginArea (Rect (50,50,100,100));	
signin = GUILayout.Button ("Signin");//returns true when clicked	
signup = GUILayout.Button ("Signup");
GUILayout.EndArea ();
if(signup)		
DoSignUp();	
}
function DoSignUp()
{	
print("inside");	
GUILayout.BeginArea (Rect (50,50,100,100));	
GUILayout.Label ("Form");	
GUILayout.EndArea();
}

The buttons Signin and Signup are seen initially. After I click the signup button, it should call the other function. It is going inside the DoSignUp() function and printing the line “inside”. But the label “Form” is not printed. Can anyone tell me why?

Hi,

GUILayout.Button returns if button was pressed in each frame.
Once the button is pressed signup becomes true and that label is drawn. But on next frame button is NOT pressed and signup becomes false again.

Do this:
if (GUILayout.Button())
singup = true;

Thanks! That works