Screen.resolutions 分辨率列表

static var resolutions : Resolution[]


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