- Home /
Question by
oliver-jones · Nov 28, 2010 at 10:27 PM ·
guibuildresolution
GUIs Do Not Decrease With Resolution
Hello,
When I build my game, and select the lowest resolution, the scene decreases in size (which is okay) but the GUIs don't they all stay the exactly the same size as a high res game would?
Why?
Comment
I recommend searching here and on the forums for 'resolution-independent gui' (the topic comes up quite frequently).
Best Answer
Answer by Jay_Adams · Nov 28, 2010 at 10:34 PM
You've got to use a GUISkin and something like this:
// Set up gui skin GUI.skin = guiSkin;
// Our GUI is laid out for a 1920 x 1200 pixel display (16:10 aspect). The next line makes sure it rescales nicely to other resolutions.
GUI.matrix = Matrix4x4.TRS (Vector3(0, 0, 0), Quaternion.identity, Vector3 (Screen.height / nativeVerticalResolution, Screen.height / nativeVerticalResolution, 1));
//destruction counter placement
DrawLabelBottomRightAligned( destructionCounterOffset, CollisionScript.playerPoints.ToString ( "Destruction: " + CollisionScript.playerPoints) );
}
//for damage count e\text function DrawLabelBottomRightAligned (pos : Vector2, text : String) { GUI.Label(Rect (pos.x, nativeVerticalResolution - pos.y, 1200, 120), text); }
Okay, another thing - how do I use the 19:6 ratio by default when I build game, it keeps going to the standalone? Thanks