赞
踩
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Lesson12 : MonoBehaviour { void Start() { //常用的 //1.得到当前屏幕的分辨率 // 得到的是显示器的分辨率 Resolution r = Screen.currentResolution; print("宽:" + r.width + "高:" + r.height); //2.屏幕窗口当前宽高 // 得到的是Game窗口的宽高 print(Screen.width); print(Screen.height); //3.设置屏幕休眠模式 Screen.sleepTimeout = SleepTimeout.NeverSleep; //不常用的 //1.运行时是否全屏模式 Screen.fullScreen = true; //2.设置窗口模式 // -独占全屏 FullScreeMode.ExclusiveFullScreen // -全屏窗口 FullScreeMode.FullScreenWindow // -最大化窗口 FullScreeMode.MaximizedWindow // -窗口模式 FullScreeMode.Windowed Screen.fullScreenMode = FullScreenMode.FullScreenWindow; //3.移动设备屏幕转向相关 // 允许自动旋转为左横向 (Home键在左侧 就是左横向) Screen.autorotateToLandscapeLeft = true; // 允许自动旋转为右横向 (Home键在右侧 就是右横向) Screen.autorotateToLandscapeRight = true; // 允许自动旋转为竖屏 (Home键在下 就是竖屏) Screen.autorotateToPortrait = true; // 允许自动旋转为纵向倒着 (Home键在上 就是纵向倒着) Screen.autorotateToPortraitUpsideDown = true; //4.指定屏幕显示方向 // 定死了 只能左横向(Home键在左侧) Screen.orientation = ScreenOrientation.LandscapeLeft } }
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Lesson12 : MonoBehaviour
{
void Start()
{
//设置分辨率(一般移动设备不使用)
//参数1 宽
//参数2 高
//参数3 是否全屏
Screen.SetResolution(1920, 1080, true);
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。