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

    设置全屏: 

    Screen.SetResolution(Screen.width, Screen.height, true);//true全屏,false不是全屏

  • 相关阅读:
    ACM-ICPC ShangHai 2014
    DEBUG感想
    WireShark 使用日记
    C++ 备忘录
    BZOJ 1022 [SHOI2008]小约翰的游戏John
    高斯消元
    BZOJ3236 [Ahoi2013]作业
    BZOJ P3293&&P1045
    ZKW费用流的理解
    BZOJ 几道水题 2014-4-22
  • 原文地址:https://www.cnblogs.com/Peng18233754457/p/9243560.html
Copyright © 2020-2023  润新知