Gui Script failure

Ok so I just started trying to learn about GUIs. I start with my first script:

function OnGUI () {
	// Make a background box
	GUI.Box  (Rect (10,10,100,90), "Loader Menu");

And already i’m getting syntax failures. Method not found GUI.Box

This is also the case for GUI.Button as well. I’m guessing I broke the engine, or divided by 0. Anyone who can shed some light on this issue would really make my day. Thanks all!

You must have some problems with your Unity - this code is OK and worked fine in my machine. Try to re-install your Unity.

This could also be caused by trying to call GUI methods from inside a class called GUI, too. Like this:

public class GUI : MonoBehaviour {
    void OnGUI() {
        GUI.Box(new Rect(Screen.width * 0.5f - 50, Screen.height * 0.5f - 45, 100, 90), "Nuestro Menu");

        if (GUI.Button(new Rect(Screen.width * 0.5f - 40, Screen.height * 0.5f - 10, 80, 20), "Boton 1"))
            print("Pulsamos el Boton 1");

The compiler looks for a class named GUI, and it finds yours first, instead of the GUI class from the Unity framework.

Just change the name of your class and script, and you’ll be good.