Question about GUILayout not appearing

Hi guys, i have a problem. My code compiles, the debug.log shows but the GUILayout doesnt appear…it only appears if i put it over the IFs, see the comments. Here’s my code, thanks again for your help !

using UnityEngine;

using System.Collections;
using UnityEditor;

public class TowerMenuPopUp : MonoBehaviour
{

Ray ray;
RaycastHit hit;
GameObject guardian;
int guardianX;
int guardianY;
int guardianZ;

void Start () 
{
	guardian = GameObject.FindGameObjectWithTag("GuardianPos");
	guardianX = (int) guardian.transform.position.x;
	guardianY = (int) guardian.transform.position.y;
	guardianZ = (int) guardian.transform.position.z;
}

void Update () 
{
	ray = Camera.main.ScreenPointToRay(Input.mousePosition);

}

void OnGUI()
{
	/*GUILayout.BeginArea(new Rect(10,10,100,100));
	GUILayout.Button("Click me");
	GUILayout.Button("Or me");
	GUILayout.EndArea();*/
	
	if(Physics.Raycast(ray,out hit, Mathf.Infinity))
	{
		if (hit.transform.tag == "Guardian")
		{
			if(Input.GetMouseButtonDown(0))
			{
				Handles.color = Color.green;
				Handles.DrawWireDisc(guardian.transform.position,Camera.main.transform.position, 50.0f);
				GUILayout.BeginArea(new Rect(10,10,100,100));
				GUILayout.Button("Click me");
    			GUILayout.Button("Or me");
				GUILayout.EndArea();
				Debug.Log("WTF");
			}
		}
	}
}

}

You should not be doing Raycast or GetMouseButtonDown in OnGUI. Do that in Update, and set a variable with the state you want to use in OnGUI to display the gui.

ok so my condition is the problem, if i use a variable in the update, A.k.a boolean, will it work ? When the boolean is set to true with the GetMouseButtonDown, {pops up menu} and i can use the same boolean to close the menu ?