Unity3D에서의 GUI Scale
Unity3D 2014. 2. 7. 16:04http://drago7.tistory.com/entry/Unity3D에서의-GUI-Scale
예를 들어GUI레이아웃을 1024x768 에 맞춰서 작업을 했다고 치고, 다른 해상도에서는 확대/축소를 하고 싶다면?
private float orgScreenWidth = 1024.0f;
private float orgScreenHeight = 768.0f;
private Vector3 scale = Vector2.zero;
private Matrix4x4 svMat = Matrix4x4.identity;
void OnGUI()
{
scale.x = Screen.width / orgScreenWidth;
scale.y = Screen.height / orgScreenHeight;
scale.z = 1.0f;
svMat = GUI.matrix;
GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scale);
//
// GUI Code here!
//
GUI.matrix = svMat;
}
'Unity3D' 카테고리의 다른 글
클래스 다이어그램 (0) | 2014.02.12 |
---|---|
그는 코루틴으로 속임수를 쓴다. (0) | 2014.02.07 |
Monodevelop keyboard shortcuts (0) | 2014.02.07 |
Monodevelop 4.x code folding (0) | 2014.02.07 |
08. C# 클래스 메소드(in,out,ref) (0) | 2014.02.05 |