Unity Features 101: Unity grid (Unity 2020+)
Today I am launching a new series, the series will explain many of the Unity features that you may or may not about and some hidden little gems too. SO, let’s start with our first feature in this series: Unity Grid.
The unity grid is a built-in layout available in Unity 2020+ (previously it was called Pro-Grid and was not built-in). The grid helps you align any gameobject and snap it to the grid as long as you are in moving the objects in the Global view.
To toggle the visibility of the grid, simply in the scene view press the following button.
And here you can see it in action…
So the main goal of the unity grid is to snap an object to it and in order to enable snapping freely, then you must first select a game object and then click on the Magnet button near Global.
Now that the magnet is enabled, as you move the object around, it will snap to position based on the grid settings.
As you can see, you can move and the object will snap, and you can also incrementally snap the game object, that is moving it by small snaps instead of the normal bigger snap. To incrementally snap the object you press “CTRL” and move it. This also works for rotation and scaling of the object.
To open the grid settings you have to click on the arrow near the grid visibility toggle, the press the 3 dots and open the edit settings.
The settings allow you to change the grid size based on what your project needs. You can even set the size differently on the X, Y and Z axis. This is useful if are building a house and the wall is much higher than the width.
Here you can also the incremental snapping for position, rotation, and scaling.
There are two useful features of the settings: Set grid position and align selection to grid.
Set Grid Position option allows you to set the position of the grid based on which object is selected. So say you have 3 floors building and you want to start snapping on the 3d floor; instead of keeping the grid on the 0,0,0 position, you can set its position based on the 3d floor itself.
As you can see, the grid was set to the position of the red object, and you can easily reset the grid position by pressing “Reset”.
Align Selection to grid allows you to snap unaligned objects to the grid. Say you have 3 objects near each other but not snap. Simply press the button and they will align to the grid.
So here, the selected objects were aligned to the nearest snapping point.