private void MatchScreen()
{
float screenHeight = Screen.height;
float orthographicSize = this.GetComponent<Camera>().orthographicSize;
float aspectRatio = Screen.width * 1.0f / Screen.height;
float cameraWidth = orthographicSize * 2 * aspectRatio;
if (cameraWidth < devWidth)
{
orthographicSize = devWidth / (2 * aspectRatio);
this.GetComponent<Camera>().orthographicSize = orthographicSize;
}
}
网友评论