scale gui without moving position

Is there a way to scale a gui box,textbox ect.. the same way you scale gui text?

You can scale gui text but unchecking pixel correct and just use the scale boxes under transform and scale it relative to screen size.

example:

alt text When I try to scale a GUI.TextArea,button, box, ect.. it moves were the boxes are located and changes the size of them. I just want the size to change not the location.

example at 1024x768:

alt text

example at 600x 450:

alt text

I would like the gui text area and button to stay in the same general location but scale its length and width like the GUIText does.

Here is the code that I have so far:

 var playerName = "";
var password = "";
//var Nstyle : GUIStyle;
//var Pstyle : GUIStyle;
//var Entstyle: GUIStyle;

//example for resolution independent GUI scaling var native_height : float = 1080; var native_width : float = 1920; var pStyle : GUIStyle;

var actual_height : float; var actual_width : float; var ry : float; var rx : float;

function OnGUI () { //set up scaling actual_height = Screen.height; actual_width = Screen.width; ry = actual_height / native_height; rx = actual_width / native_width;

GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (rx, ry, 1)); playerName = GUI.TextArea (Rect (Screen.width / 2 + 300, Screen.height / 2 + 110, 300, 50), playerName); password = GUI.TextArea (Rect (Screen.width / 2 + 300, Screen.height / 2 + 210, 300, 50), password);

//firstTime = false; if (GUI.Button (Rect (Screen.width / 2 + 300, Screen.height / 2 +280, 130, 40), "Enter")) { PlayerPrefs.SetString("Player Name", playerName); print (PlayerPrefs.GetString("Player Name"));

} }

If anyone can tell me how to fix this that would be great :)

When you do the GUI scaling like you have it there, you don't want to be using `Screen.width` or `Screen.height` in your `GUI` calls for individual GUI elements. Instead you want to use a fixed size. In your example, try doing this:

playerName = GUI.TextArea (Rect (native_width / 2 + 300, native_height / 2 + 110, 300, 50), playerName);
password = GUI.TextArea (Rect (native_width / 2 + 300, native_height / 2 + 210, 300, 50), password);

if (GUI.Button (Rect (native_width / 2 + 300, native_height / 2 +280, 130, 40), "Enter"))     {
// etc

playerName = GUI.TextArea (Rect (Screen.width / 2 + 300, Screen.height / 2 + 110, 300, 50), playerName);
    password = GUI.TextArea (Rect (Screen.width / 2 + 300, Screen.height / 2 + 210, 300, 50), password);

Get rid of the +110

Change it to a pure ratio like Screen.height/3