以下程式碼可以取得遊戲的解析度資訊,方便做運算
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官方文件