GUI.DragWindow() doesnt work - cant figure out why

Window works fine, but I cant drag it. I have tried clicking every where on it, and of course I am not clicking on the buttons. What am I doing wrong? I havent had trouble with this before.

Thanks!

Here I call the window in OnGUI

void OnGUI()
{
		//Heads up Display Tool Bar
		GUI.Window(hudWindowID, HudWindowRect, HudWindowFunction, "ToolBar1");
}

ANd here is the window:

private void HudWindowFunction(int id)
	{
		GUILayout.BeginHorizontal();
		if(GUILayout.Button ("Ability 1", GUILayout.Width(60), GUILayout.Height(60)))
		{
			//ability 1
		}
		
		if(GUILayout.Button ("Ability 2", GUILayout.Width(60), GUILayout.Height(60)))
		{
			//ability 2
		}
		
		if(GUILayout.Button ("Ability 3", GUILayout.Width(60), GUILayout.Height(60)))
		{
			//ability 3
		}
		
		if(GUILayout.Button ("Ability 4", GUILayout.Width(60), GUILayout.Height(60)))
		{
			//ability 4
		}
		GUILayout.EndHorizontal();
		
		GUI.DragWindow();
	}

It’s very simple :wink:

Instead of

  GUI.Window(hudWindowID, HudWindowRect, .....

you need :

  HudWindowRect = GUI.Window(hudWindowID, HudWindowRect, .....

HudWindowRect is the position and size of your window. Since this parameter is not a ref-parameter it can’t be changed by the window function. That’s why it returns the new position