Unity Scene Screen.resolutions 分辨率列表

Screen.resolutions 分辨率列表

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);

    }

}

猜你喜欢

转载自www.cnblogs.com/Peng18233754457/p/9243560.html