Gui scale to Resolution

Hey, ive been making a game and recently have started putting in some gui. The gui is an inventory which isnt quite done. Right now it is scaled 700x600 but if I play the game in a different resolution the scaling gets messed up. Can someone please tell me what to do. here is my script -

var MenuSkin : GUISkin;



 

var toggleTxt : boolean;
 

function OnGUI() {

GUI.skin = MenuSkin;

    GUI.BeginGroup(new Rect(Screen.width/2-350,Screen.height/2-300,700,600));

        GUI.Box(Rect(0,0,700,600),"Inventory");

            GUI.Button(Rect(0,25,100,20),"I am a button");
            
                                        GUI.EndGroup ();

}

Hello Josie, you should use Screen.width and Screen.height Here is how it should look like:

var toggleTxt : boolean;

function OnGUI() 
{
    GUI.skin = MenuSkin;
    GUI.BeginGroup(new Rect(Screen.width/2-350,Screen.height/2-300,700,600));
    GUI.Box(Rect(0,0,Screen.width, Screen.height),"Inventory");
    GUI.Button(Rect(0,25,100,20),"I am a button");
    GUI.EndGroup();
}

It should work.