Build your own snap to grid system in minutes with this project as a starting point or sample. You can create a Unity3D Grid based game easily by creating a single component responsible for giving your project the correct grid coordinates.
This basic grid system works by taking in a vector3 and providing the nearest point on the grid to that position. Your code only needs to call into the Grid class to get that location, with no other modifications. The grid can be resized or offset by simply moving it around in the scene, and you can visualize the layout using OnDrawGizmos as seen in the video.
Video – Unity3D Grid
Source Code
Project Download
https://unity3dcollege.blob.core.windows.net/site/Downloads/Snap%20To%20Grid.zip