Pixel snap and anti-aliasing not working?

So I’ve been having an issue with lines in between my tiles in my 2D game. The go-to fix is usually to turn off anti-aliasing in project settings and turn on pixel snap on everything, but somehow pixel snap has made the lines more pronounced then they were before. Anyone else had this problem?

This (above) is what the game looks like with pixel snap on; the lines are permanent when my character walks. Without pixel snap, the lines just flash in and out.

Hi there, sorry it took a while to get an answer for this one, I just found this, but if you didn’t already work it out I can sort this one out for you.

When scaling sprites to particular resolutions, sometimes Unity uses a little bit of whatever’s around the edge of the sprite in your texture when scaling up (something to do with the resolution not being an integer multiple of your sprite’s resolution), so what you’re seeing there is either a piece of the tile you have stored above it in your tile sheet, or transparency. Seems like the former when you look at how above your trees there’s a brown line and it’s black above everywhere else.

The solution is to separate your tiles from one another, have a gap between each tile of 2 pixels or so, and add some ‘bleed’ (padding) to the edge of each tile. For example you’d want to put a 1 pixel border of green around your grass tiles, or if the tile is complex then just copy the edge pixels. Then Unity will fill that tiny pixel gap with that colour, and it will be unnoticeable.

^ Here’s an example with some tiles of mine. The blue line shows where Unity slices them. I have 1px extra pixels around the edge of every tile. Do this and Unity will stop giving you those lines.

Super Tilemap Editor on the asset store comes with an atlas editor feature that can do this for you in a couple of clicks.