Convert Mouse Position to nearest .16

I’m working on a 2D game where all the sprites are 16x16 and I want to create a level builder where you place the blocks at the location of the mouse, but I need to convert the mouse position to the nearest .16 or something and I’ve tried for a long time and couldn’t do it.

hello, you can do something like this,

Debug.Log(new Vector3(mousePosition.x - (mousePosition.x % 0.16f), mousePosition.y - (mousePosition.y % 0.16f), 0));

this will just make your mouse move from 0.16 to 0.16, and should work although not tested, if you want a nicer approach you should be comparing the result of mouseposition % 0.16 and if its more than 0.08f add extra 0.16 to the position (thats just for making sure that it will be located to the nearest position, thats just an if but reply if you have any issues)