前往
大廳
主題

Unity 取得當前畫面的解析度

梯太 | 2021-01-30 09:15:32 | 巴幣 1002 | 人氣 1841

以下程式碼可以取得遊戲的解析度資訊,方便做運算
Screen.currentResolution
可以取得解析度資訊

Screen.width 、 Screen.height
可以取得畫面的寬以及高

        Debug.Log(Screen.currentResolution);
        //1920 x 1080 @ 60Hz

        //Output the current screen window width in the console
        Debug.Log("Screen Width : " + Screen.width);
        //Screen Width : 1920

        //Output the current screen window height in the console
        Debug.Log("Screen Height : " + Screen.height);
        //Screen Height : 1080

更多的Screen方請參考Unity官方文件
送禮物贊助創作者 !
0
留言

創作回應

更多創作