GUI Rescale at Resolution (C#)

Can somebody help me with this script, I’m trying to make the rescale automatically at low resolutions. Here is what I have

UILayout.BeginArea (new Rect (190, 45, Screen.width - 450, 50));
    			float FilScreenWidth = Rect.width / 800;
    			float rectWidth = FilScreenWidth * Screen.width;
    			float FilScreenHeight = Rect.height / 600;
    			float rectHeight = FilScreenHeight * Screen.height;
    			float rectX = (Rect.x / 800) * Screen.width;
    			float rectY = (Rect.y / 600) * Screen.height;
    			GUILayout.BeginHorizontal ();

However I get these Compiler Errors:
error CS0120: An object reference is required to access non-static member `UnityEngine.Rect.width’

error CS0120: An object reference is required to access non-static member `UnityEngine.Rect.height'

error CS0120: An object reference is required to access non-static member `UnityEngine.Rect.x'

error CS0120: An object reference is required to access non-static member `UnityEngine.Rect.y'

If someone could help that’d be awesome. My knowledge of GUI, let alone in C# is very limited so don’t yell at me xD

Hi,

Generally with this kind of error you just have to declare your var like this :

public class GUIRescaler()
{
    public static float Rect.height;

    void Start()
    {
       Rect.height = Screen.height * percentValue;
    }
    void OnGUI()
    {
      GUI.Button(new Rect(Rect.width, Rect.height .....);
    }
}

you need to declare your var public static.

Hope it will help