Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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;
    DisplayBox();
}

private void DisplayBox() {
     windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "", GUILayout.Width(800));    
}
void DoMyWindow(int windowID) {
    DisplayName();
    DisplayPointsLeft();
    DisplayAttributes();
    DisplayVitals();
    DisplaySkills();
    DisplayCreateButton();
    DisplayResetButton();
}

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?

share|improve this question

1 Answer 1

Figured it out.

Changed

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

to

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

Hope this helps someone later on.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.