Screen.width
public static int width ;
描述
屏幕窗口的当前宽度(以像素为单位)(只读)。
此为玩家窗口的实际宽度(在全屏模式下,它也是当前分辨率)。
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Example : MonoBehaviour { void Start() { //Output the current screen window width in the console Debug.Log("
Unity中提供了Screen.width属性来获取屏幕窗口的当前宽度,以像素为单位。这个值是只读的,反映的是玩家窗口的实际宽度,全屏模式下则为当前分辨率。注意它区别于电脑屏幕的真实分辨率,可用于游戏窗口分辨率的检测。
订阅专栏 解锁全文
4177

被折叠的 条评论
为什么被折叠?



