zoukankan      html  css  js  c++  java
  • 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不是全屏

  • 相关阅读:
    python中实现mysql连接池
    flask简单的路由分发
    用进程池创建子进程
    用类创建子进程
    用函数创建子进程
    fiddler抓包工具使用
    requests库的小技巧
    requests库的get请求,带有cookies
    requests库的post请求
    Android下Json数据解析
  • 原文地址:https://www.cnblogs.com/Peng18233754457/p/9243560.html
Copyright © 2011-2022 走看看