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));
    }

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐