I am fairly new to Unity, but picking things up quick. This is actually one of the first problems I have come across that has me stumped.

I am trying to print a good amount of components onto my GUI on top of my window.

Although, I can only see half of only one component at the upper left hand side of my window, in which the label says "Name". I can actually only see Na and half of the m.

(If I do NOT use the window, and just paint my components out on my OnGUI everything will paint just fine and looks exactly how I want)

To me, this sounded like some sort of Rect(); issue or something along the lines of the width and height not being set properly...Although they are.

Ill provide all the code that has any relation to the GUI. (There is only one object this script is attached to and it inherits from MonoBehavior)

You will notice that the Rects() or any Width/Hieght will be set to some high number, it was just to make sure it wasnt that line of code screwing up my window.

public GUISkin mySkin;
public Rect windowRect = new Rect();

void OnGUI() {
    GUI.skin = mySkin;

private void DisplayBox() {
     windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "", GUILayout.Width(800));    
void DoMyWindow(int windowID) {

These functions in the DoMyWindow just call GUI.Component statements to paint the gui.

Like I said above, if I dont use the window everything works perfect.

Also, you'll notice that the windowRect has no params. Its public and they are altered to extremely high numbers in the inspector. Still no result

What am I doing wrong?


1 Answer 1


Figured it out.


windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "", GUILayout.Width(800)); 


windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "", "window"); 

Hope this helps someone later on.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .