C# => public static Resolution[] resolutions;
Description 描述
All fullscreen resolutions supported by the monitor (Read Only).
顯示器支持的所有全屏分辨率。(只讀)
The returned resolutions are sorted by width, lower resolutions come first. Note that the array will always be empty on Android devices since the resolution is variable (within reason) and so there is no restricted set of resolutions to choose from.
返回分辨率的列表,安裝寬帶排序,較低的分辨率排在前面。注意,在Android設備該列表總是為空,因為該分辨率是變化的,所以選擇沒有限制的分辨率。
C#:
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Start() { Resolution[] resolutions = Screen.resolutions; foreach (Resolution res in resolutions) { print(res.width + "x" + res.height); } Screen.SetResolution(resolutions[0].width, resolutions[0].height, true); } }
設置全屏:
Screen.SetResolution(Screen.width, Screen.height, true);//true全屏,false不是全屏
