is there a way to auto scale GUI depending on screen resolution

is there a method that i can use to auto scale GUI depending on the screen resolution ?

When dealing with multiple rects, it might help to use a “scaler function.”

var desiredRects : Vector2[]; //array of preferred widths and heights.
var scaledRects : Rect[];

private var i : int = 0;

function Awake() {
    scaledRects = new Rect[desiredRects.Length];
    for(i < desiredRects.Length; i++) {
        scaledRects _= new Rect((Screen.width / 2) - (desiredRects*.x / 2),*_

(Screen.height / 2) - (desiredRects*.y / 2),*
desiredRects_.x, desiredRects*.y);
}
}*_

function OnGUI() {
GUI.Box(scaledRects[0], “Menu With Rect at index of Zero”);
}