Search Unity

GUI not compiling

Discussion in 'Immediate Mode GUI (IMGUI)' started by CoherentInk, Nov 9, 2007.

  1. CoherentInk

    CoherentInk

    Joined:
    Jul 16, 2006
    Posts:
    216
    I've just upgraded to 2.01, and I've been really excited about the new GUI in the release. Unfortunately, I'm having some trouble trying it out. I've put in the code based on one of the examples, and I'm getting errors on compilation:

    Code (csharp):
    1. Assets/Scripts/GUI.js(3) error BCE0019: 'Box' is not a member of 'GUI'.
    2. Assets/Scripts/GUI.js(5) error BCE0019: 'Button' is not a member of 'GUI'.
    Here is script in its entirety:

    Code (csharp):
    1.  
    2. function OnGUI () {
    3.     GUI.Box (Rect(10,10,100,90), "Main Menu");
    4.    
    5.     if (GUI.Button (Rect(20,40,80,20), "Button")) {
    6.         print("You clicked the button!");
    7.     }
    8. }
    9.  
    I'm running 10.4.10 on a PowerBook G4 if that makes any difference. Thanks.
     
  2. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    GUI is the exact name of a built-in Unity class, so you just need to change GUI.js to some other name.

    Cheers,
    -Jon
     
  3. CoherentInk

    CoherentInk

    Joined:
    Jul 16, 2006
    Posts:
    216
    Awesome-- glad to know it was something so simple!