public Camera Camera;
float desginWidth = 1920f;
float desginHeigth = 1080f;
float desginOrthographicSize = 5.4f;
private void Update()
{
float desginScal = desginWidth / desginHeigth;
float scalRate = (float)Screen.width / (float)Screen.height;
if (scalRate< desginScal)
{
float scal = scalRate / desginHeigth;
desginOrthographicSize = 5.4f/ scal;
}
else
{
desginOrthographicSize = 5.4f;
}
Debug.Log(desginOrthographicSize);
}
private void OnGUI()
{
GUILayout.Label(string.Format("<size=60><color=red>{0}x{1}</color></size>", Screen.width, Screen.height));
}