# SnapValue

> Rounds value to the closest multiple of snap if snapping is active (refer to EditorSnapSettings.incrementalSnapActive ). Note that snap can only be positive.

## Definition

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

## SnapValue(float, float)

Rounds `value` to the closest multiple of `snap` if snapping is active (refer to [EditorSnapSettings.incrementalSnapActive](/engine/6000.6/script-reference/unityeditor/editorsnapsettings/incrementalsnapactive.md)). Note that snap can only be positive.

```csharp
public static float SnapValue(float value, float snap)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The value to snap.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The increment to snap to.

### Returns

| Type                                                          | Description                                                                                                                                                                                                                                |
| ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | If (refer to [EditorSnapSettings.incrementalSnapActive](/engine/6000.6/script-reference/unityeditor/editorsnapsettings/incrementalsnapactive.md)) is active, rounds `value` to the closest multiple of `snap` (snap can only be positive). |

## SnapValue(Vector2, Vector2)

Rounds `value` to the closest multiple of `snap` if snapping is active. Note that snap can only be positive.

```csharp
public static Vector2 SnapValue(Vector2 value, Vector2 snap)
```

### Parameters

**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): The value to snap.**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): The increment to snap to.

### Returns

| Type                                                              | Description                                                                                          |
| ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| [Vector2](/engine/6000.6/script-reference/unityengine/vector2.md) | If snapping is active, rounds `value` to the closest multiple of `snap` (snap can only be positive). |

## SnapValue(Vector3, Vector3)

Rounds `value` to the closest multiple of `snap` if snapping is active. Note that snap can only be positive.

```csharp
public static Vector3 SnapValue(Vector3 value, Vector3 snap)
```

### Parameters

**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The value to snap.**** (\[Vector3]\(/engine/6000.6/script-reference/unityengine/vector3)): The increment to snap to.

### Returns

| Type                                                              | Description                                                                                          |
| ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| [Vector3](/engine/6000.6/script-reference/unityengine/vector3.md) | If snapping is active, rounds `value` to the closest multiple of `snap` (snap can only be positive). |
