Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SnapToGrid

Rounds each Transform.position or Vector3 to the closest multiple of EditorSnapSettings.gridSize.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor

SnapToGrid(Transform[], SnapAxis)

Rounds each Transform.position or Vector3 to the closest multiple of EditorSnapSettings.gridSize.
public static void SnapToGrid(Transform[] transforms, SnapAxis axis = SnapAxis.All)

Parameters

transforms

The transforms to snap.

The axes on which to apply snapping.

SnapToGrid(Vector3[], SnapAxis)

Rounds each Transform.position or Vector3 to the closest multiple of EditorSnapSettings.gridSize.
public static void SnapToGrid(Vector3[] positions, SnapAxis axis = SnapAxis.All)

Parameters

positions

The positions to snap.

The axes on which to apply snapping.