Snap
Rounds value to the closest multiple of snap.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
Snap(float, float)
Rounds to the closest multiple of .
valuesnappublic static float Snap(float val, float snap)
Parameters
Returns
Type | Description |
|---|---|
| float | The rounded value. |
Snap(Vector2, Vector2)
Rounds to the closest multiple of .
valuesnappublic static Vector2 Snap(Vector2 val, Vector2 snap)
Parameters
Returns
Type | Description |
|---|---|
| Vector2 | The rounded value. |
Snap(Vector3, Vector3, SnapAxis)
Rounds to the closest multiple of .
valuesnappublic static Vector3 Snap(Vector3 val, Vector3 snap, SnapAxis axis = SnapAxis.All)
Parameters
Returns
Type | Description |
|---|---|
| Vector3 | The rounded value. |