鸟语天空
脚本设置屏幕分辨率
post by:追风剑情 2019-5-29 10:59

示例

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ScreenResolution : MonoBehaviour
{
    [Header("分辨率")]
    public int width = 1920;
    public int height = 1080;
    public int refreshRate = 0;
    public bool fullscreen = true;
    public ESleepTimeout sleepTimeout = ESleepTimeout.SystemSetting;

    //参见SleepTimeout类中定义的常量
    public enum ESleepTimeout
    {
        NeverSleep = -1,
        SystemSetting = -2,
    }

    void Awake ()
    {
        Screen.SetResolution(width, height, fullscreen, refreshRate);
        Screen.sleepTimeout = (int)sleepTimeout;
    }
}

11111.png

评论:
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容