# width

> The width of the rectangle, measured from the X position.

## Definition

* **Type:** Property
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public float width { readonly get; set; }
```

### Remarks

Setting this value will also change [Rect.xMax](/engine/6000.7/script-reference/unityengine/rect/xmax.md).

### Examples

```csharp
using UnityEngine;

public class RectExample : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        Rect rect = new Rect(10, 10, 50, 30);
        Debug.Log("width = " + rect.width); // prints: width = 50
        rect.width = 20;
        Debug.Log("new max x = " + rect.xMax); // prints: new max x = 30
    }
}
```
