GUI.Box error

When I try to create a GUI Box object, I get the error “Box is not a member of GUI”:

var rect = Rect(10,10,20,20);

function OnGUI(){
	GUI.Box ( rect, " " );

}

Any ideas?

Your code works perfectly over here. Are you sure there’s any problem?

I think i found the root of the problem. The script itself was named “GUI” and so it was probably trying to access a “Box” element inside itself. I renamed it to GUITest and now I get no errors.

Ah, that would do it. You have to be careful on what you name your scripts so as not to do things like that.