# Max

> Creates a vector that is made from the largest components of two vectors.

## Definition

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

## Max(Vector2, Vector2)

Creates a vector that is made from the largest components of two vectors.

```csharp
public static Vector2 Max(Vector2 lhs, Vector2 rhs)
```

### Parameters

**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): The first vector to compare.**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): The second vector to compare.

### Returns

| Type                                                              | Description                                                       |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| [Vector2](/engine/6000.6/script-reference/unityengine/vector2.md) | A vector that is made from the largest components of two vectors. |

### Remarks

Additional Resources: [Vector2.Min](/engine/6000.6/script-reference/unityengine/vector2/min.md) function.

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    void Start()
    {
        Vector2 a = new Vector2(1, 3);
        Vector2 b = new Vector2(4, 2);
        print(Vector2.Max(a, b)); // prints (4.0,3.0)
    }
}
```

## Max(Vector2, Vector2)

Creates a vector that is made from the largest components of two vectors.

```csharp
public static Vector2 Max(in Vector2 lhs, in Vector2 rhs)
```

### Parameters

**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): The first vector to compare.**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): The second vector to compare.

### Returns

| Type                                                              | Description                                                       |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| [Vector2](/engine/6000.6/script-reference/unityengine/vector2.md) | A vector that is made from the largest components of two vectors. |

### Remarks

Additional Resources: [Vector2.Min](/engine/6000.6/script-reference/unityengine/vector2/min.md) function.

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    void Start()
    {
        Vector2 a = new Vector2(1, 3);
        Vector2 b = new Vector2(4, 2);
        print(Vector2.Max(a, b)); // prints (4.0,3.0)
    }
}
```
