|
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:
example at 1024x768:
example at 600x 450:
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);
} } If anyone can tell me how to fix this that would be great :)
(comments are locked)
|
|
When you do the GUI scaling like you have it there, you don't want to be using thanks that worked :)
Jun 27 '10 at 05:20 PM
Ryan 1
Be sure to mark the answer as accepted.
Jun 27 '10 at 05:28 PM
Tetrad
(comments are locked)
|
Get rid of the +110 Change it to a pure ratio like Screen.height/3
(comments are locked)
|
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.

