Pixel Snap!

Hello, hope this can help people out, it’s been useful for my pixel art game as I needed something other than Unity’s built in grid snapping tool. This snapping tool is for 2D pixel art games, you can access it under the Window/Pixel Grid menu. You supply it with the Pixels Per Unit you’re using, then how big the grid is in pixels. It tells you the grids scale in units and how many objects you have selected. As an example of what this does the first image you can see that the object isn’t aligned pixel perfect but in the second image it is.

5918231–632246–PixelGrid.cs (3.6 KB)

3 Likes

Thank you!

1 Like

This is such a helpful script - thanks for sharing! A must have for anyone working with pixels.

wow this script just saved me! thank you friend, you are a friend haha years later

Fantastic! Thank you.

I absolutely love this script but noticed a small issue where: if you select an object and then select another one (by clicking on it in the scene view) the new one no longer snaps. I am new to editor scripts but I believe I fixed the issue.

9792738–1405425–PixelSnap.cs (3.27 KB)

2 Likes

if you set your grid snapping to 1/pixels per unit you should just be able to use grid snapping as long as your pivot is aligned on the pixel gird.