place 1X1X1 brick in a invisible 3d grid?

hi does anyone know a script that will do so if you click some where a 1X1X1 brick will be creted where i pressed but it has to stick to a 1X1X1 grid

example: i click on the floor somewhere and a brick will be created but has to stick to the grid. now if i then again click on the brick, another brick will be created still sticking to the grid and be placed on the side of the brick i pressed.

Please do help

Ahoy there, you could try using `Mathf.Round()` on the x, y and z coordinates of the position you intend to instantiate the new brick at.