using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameCamera : MonoBehaviour { float devWidth = 10.8f; // Start is called before the first frame update void Start() { float screenHeight = Screen.height; // Debug.Log("screenHeight = " + screenHeight); float orthographicSize = this.GetComponent().orthographicSize; float aspectRatio = Screen.width * 1.0f / Screen.height; float cameraWidth = orthographicSize * 2 * aspectRatio; // Debug.Log("cameraWidth = " + cameraWidth); if (cameraWidth < devWidth) { orthographicSize = devWidth / (2 * aspectRatio); // Debug.Log("new orthographicSize = " + orthographicSize); this.GetComponent().orthographicSize = orthographicSize; } } // Update is called once per frame void Update() { } }