Search Unity

GUI.Box error

Discussion in 'Immediate Mode GUI (IMGUI)' started by Dragon Rider, Jan 19, 2008.

  1. Dragon Rider

    Dragon Rider

    Joined:
    Jan 17, 2008
    Posts:
    280
    When I try to create a GUI Box object, I get the error "Box is not a member of GUI":

    Code (csharp):
    1.  
    2.  
    3.  
    4. var rect = Rect(10,10,20,20);
    5.  
    6. function OnGUI(){
    7.     GUI.Box ( rect, " " );
    8.  
    9. }
    10.  
    11.  
    Any ideas?
     
  2. nickavv

    nickavv

    Joined:
    Aug 2, 2006
    Posts:
    1,801
    Your code works perfectly over here. Are you sure there's any problem?
     
  3. Dragon Rider

    Dragon Rider

    Joined:
    Jan 17, 2008
    Posts:
    280
    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.
     
  4. nickavv

    nickavv

    Joined:
    Aug 2, 2006
    Posts:
    1,801
    Ah, that would do it. You have to be careful on what you name your scripts so as not to do things like that.