- Home /
Gui problems.
I have this problem with gui:I want to move the buttons to the middle of the screen in any Resoultion.
myproblem.png
(363.9 kB)
Comment
Best Answer
Answer by inkspot · Jul 17, 2013 at 11:35 AM
You can use GUI.matrix for this, it will scale based on native dimensions something like this:
var native_width : float = 1024;
var native_height : float = 768;
function OnGUI () {
var rx : float = Screen.width / native_width;
var ry : float = Screen.height / native_height;
GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (rx, ry, 1));
///// gui stuff here
}