Screen.resolutions 分辨率列表

static var resolutions : Resolution[]

Description描述

All fullscreen resolutions supported by the monitor (Read Only).

显示器支持的所有全屏分辨率。(只读)

The returned resolutions are sorted by width, lower resolutions come first.

返回分辨率的列表,安装宽带排序,较低的分辨率排在前面。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public Resolution[] resolutions = Screen.resolutions;
	public void Awake() {
		foreach (Resolution res in resolutions) {
		print(res.width + "x" + res.height);
	}
		Screen.SetResolution(resolutions[0].width, resolutions[0].height, true);
	}
}
var resolutions : Resolution[] = Screen.resolutions;
// Print the resolutions
//打印分辨率列表
for (var res in resolutions) {
	print(res.width + "x" + res.height);
}
// Switch to the lowest supported fullscreen resolution
//切换到最低支持的全屏分辨率
Screen.SetResolution (resolutions[0].width, resolutions[0].height, true);

参考: Resolution结构, SetResolution.

Page last updated: 2011-1-17