- Home /
Popup window size problem
Hi there!
I was trying to create a popup window in my game, but I'm having some problems with it. I tried this way:
var windowRect : Rect = Rect (20, 20, 1000, 1000);
function OnGUI () {
windowRect = GUI.Window (0, windowRect, CreateWindow, "Popup Window");
}
function CreateWindow (ID : int) {
GUI.DragWindow();
}
But, not matter which dimensions the windowRect has, the window does not get resized. Do you have any idea?
Also, sometime, after I modified my script in MonoDevelop, it looks like the game still run using the older script version, so I need to refresh the file in the Project. Is it normal?
Answer by ezlockwo · Feb 18, 2013 at 06:36 AM
So I was having the same issue as you, and as I was playing around with the code, I began to notice that changing the values in windowRect did not effect the size of the window being created. So I moved the code declaring windowRect out of global and into the OnGUI function, which seems to fix the problem. I'm still not sure why http://docs.unity3d.com/Documentation/ScriptReference/GUI.Window.html has the variable in global or why the global variable is not being used by the parameters of GUI.Window.
Your answer
Follow this Question
Related Questions
how to get Gui in OnGUI function to resize with the window? 1 Answer
Move one GUI window when another is moved? 0 Answers
How to open a separate window 1 Answer
Can't Drag GUI.Window's!!! 2 Answers
determine if dragging window 0 Answers