Using GUI.Window???

Up until now I’ve been using standard GUI Components on the screen, drawing Boxes and then drawing inside of them for interfaces, however I’m aware that this isn’t really the proper way and have decided to move to Windows to allow my users a more customizable HUD while playing my game. (Allowing them to move interfaces around, etc) however my problem is as follows.

I know how to draw a GUI.Window, and I know how to make it be the size that I want it to regardless of resolution (All of my GUI Calculations are done using equations such as

(Screen.width / 2) - (Screen.width / 8)

where a defined pixel-amount is never set, so it’s in exactly the same place regardless of your devices resolution, however using Screen.Width and Screen.height inside of a GUI.Window just doesn’t cut it. I was expecting to be able to do something like myWindow.width and myWindow.height, but apparently I’m doing something wrong.

Any pointers?

Just save the window rect to a variable. Look this code from the script reference:

    public class Example : MonoBehaviour
    {
        public Rect windowRect = new Rect(20, 20, 120, 50);

        void OnGUI()
        {
            windowRect = GUI.Window(0, windowRect, DoMyWindow, "My Window");
        }

        void DoMyWindow(int windowID)
        {
            //Here you can use "windowRect.width" etc
            if (GUI.Button(new Rect(10, 20, 100, 20), "Hello World"))
                print("Got a click");
        }
    }