Trouble with GUI.Window

I’m having trouble getting GUI.Window to work properly.

I want to have a draggable window but when I do this the GUI.Window ignores the initial position on the screen.

var windowRect : Rect = Rect (300, 400, 100, 100);

function OnGUI () {
	
	windowRect = GUI.Window (0, windowRect, WindowFunction, "Navigation");
	
}

function WindowFunction (windowID : int) {
	// Draw any Controls inside the window here
	
	// Make the windows be draggable.
    GUI.DragWindow (Rect (0,0,10000,20));
}

No matter what I set the initial windowRect values to be the window always appears in the same spot on the screen.

If I change to this

var windowRect : Rect = Rect (300, 400, 100, 100);

function OnGUI () {
	
	windowRect = GUI.Window (0, Rect (300, 400, 100, 100), WindowFunction, "Navigation");
	
}

function WindowFunction (windowID : int) {
	// Draw any Controls inside the window here
	
	// Make the windows be draggable.
    GUI.DragWindow (Rect (0,0,10000,20));
}

It comes up in the right place but then of course it isn’t draggable any more. Is this a bug? or am I setting it up wrong?

When you use public variables, the values in the Inspector override what you have in the code.

–Eric

That does it. Thank you once again. I’ll have to start paying you soon :smile: