# this[]

> Access the x or y component using [0] or [1] respectively.

## Definition

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

## this\[int]

```csharp
public float this[int index] { readonly get; set; }
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [float](https://learn.microsoft.com/dotnet/api/system.single) |             |

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    void Start()
    {
        Vector2 p = new Vector2();
        p[1] = 5; // the same as p.y = 5
    }
}
```
