# GetWidth()

> Gets the width of the window.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Windowing](/engine/6000.7/script-reference/unityengine/windowing.md)
* **Assembly:** UnityEngine.WindowingModule

```csharp
public int GetWidth()
```

### Returns

| Type                                                       | Description                        |
| ---------------------------------------------------------- | ---------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The width of the window in pixels. |

### Examples

```csharp
using UnityEngine;
using UnityEngine.Windowing;

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