# ClampMagnitude(Vector2, float)

> Creates a copy of a given vector, with its magnitude clamped to a maximum length.

## Definition

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

```csharp
public static Vector2 ClampMagnitude(Vector2 vector, float maxLength)
```

### Parameters

**** (\[Vector2]\(/engine/6000.0/script-reference/unityengine/vector2)): The vector to clamp.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The maximum length to clamp the vector to.

### Returns

| Type                                                              | Description                                                   |
| ----------------------------------------------------------------- | ------------------------------------------------------------- |
| [Vector2](/engine/6000.0/script-reference/unityengine/vector2.md) | A copy of `vector` with its magnitude clamped to `maxLength`. |
