using UnityEngine; using System.Collections; using UnityEngine.UI; public class CameraAdjustSize : MonoBehaviour { private float widthToBeSeen = 14.2f; void Start() { if ((float)Screen.width / (float)Screen.height > 16.0f / 9.0f) { Camera.main.orthographicSize = widthToBeSeen * Screen.height / Screen.width * 0.7f; CanvasScaler scaler = GameObject.Find("UICanvas").GetComponent(); scaler.matchWidthOrHeight = 1.0f; CanvasScaler scaler2 = GameObject.Find("UICanvas2").GetComponent(); scaler2.matchWidthOrHeight = 1.0f; } else { Camera.main.orthographicSize = widthToBeSeen * Screen.height / Screen.width * 0.5f; } QualitySettings.SetQualityLevel(5, true); } }