Skip to content

Instantly share code, notes, and snippets.

@HiromichiYamada
Created March 11, 2013 09:42
Show Gist options
  • Save HiromichiYamada/5133098 to your computer and use it in GitHub Desktop.
Save HiromichiYamada/5133098 to your computer and use it in GitHub Desktop.
private var screenScale : float;
private var scaledMatrix : Matrix4x4; // for scaling.
function Start () {
// for scaling.
screenScale = Screen.width / 320.0f; // for portlait only.
scaledMatrix = Matrix4x4.identity.Scale(Vector3(screenScale,screenScale,screenScale));
}
function OnGUI () {
// for scaling.
GUI.matrix = scaledMatrix;
var sw : int = Screen.width/screenScale;
var sh : int = Screen.height/screenScale;
// layout GUI parts as 320x480 screen.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment