Version: 2021.2
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("Screen Width : " + Screen.width); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961