Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetWidth()

Gets the width of the window.
Read time 1 minuteLast updated 12 days ago

Definition

public int GetWidth()

Returns

Type

Description

intThe width of the window in pixels.

Examples

using UnityEngine;using UnityEngine.Windowing;public class WindowWidthExample : MonoBehaviour{ void Start() { var window = GameWindow.Main; int width = window.GetWidth(); Debug.Log($"Window width: {width}"); }}