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.

最后修改:2011年1月17日 Monday 18:42

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。