GUI Nowhere to be found?

This code works fine, except I can’t find the GUI box. It prints the Debug just fine and there are no errors. I made the GUI box absurdly big so I could see it but it’s missing anyway.

static var currentObject = GameObject;

function OnGUI() {
if (Input.GetMouseButtonUp (0)) {
	var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
	var hit : RaycastHit;
	if (Physics.Raycast (ray, hit, 100))
	            if( == "_Character1"){
	            (GUI.Button (Rect (200,100,800,800), "Test"));
	             Debug.Log ("Gui popped up");

Firstly that is a button not a box, secondly the problem is that you only show the button for a little split second when all the conditions are true (getmousebuttonup and raycasthit)

If you want to see a button or any other GUI element you have to draw iw in every OnGUI call because as the function ends the GUI element gets destroyed.

The second big issue is: It is really not recommended to check the input and raycast in OnGUI function. The reason is, it can be called a lot of times per frame. So it can cause serious performance issues and the input result can be different as expected.

Here is the recommended solution if you would like to show the button after getmousebuttonup and raycast success.
Make a boolean variable to class and for start set it false. Place your conditions in update and if the conditions happens to be true set your boolean variable to true.
In OnGUI make an if statement where the condition is the upper mentioned variable and place you GUI code inside of it