Black lines on the edges of tiled sprites

I tried to build a level according to this tutorial: http://imakeinternet.com/introduction-unity-2d-game-development/

It provides a set of tiles to create platforms however when I run my game there are sometimes black lines between the tiles as I move my character around the level. I searched for the solution but I couldn’t find anything helpful for 2D.

Make sure the settings in each texture are set to “Point” mode, and not “Bilinear” or “Trilinear”.

2 Likes

Also I found that reducing the pixels per unit a small fraction, say from 100 to 99.5 after you have placed the tiles, will stop gaps appearing between them.

All that’s going to do is make them overlap a tiny bit… So yeah, it could fix the issue in a sense, but it’s better to solve the issue than to hack it.

Make sure you’re set to Point filtering mode, make sure yo’u using textures with power-of-2 dimensions, and make sure you’re only placing them in position that are multiples of 0.02, so set your snap settings for example to 0.16 if you have a 100 pixels to unit ratio. Or set your pixel ration to something like 64 and just move it by single units or half units.

Are you talking about THIS problem?

His is blue, instead of black, because the default camera background is that blue. Let me guess? Yours is black. If so, it’s the same problem.

I listed all the possible solutions inside on THIS POST.

I know this is an old thread, but I’ll post my solution here in case it helps someone.

My problem was a bit different, I had sprites with transparency in them (not tiles), and I was getting black lines on edges, especially when animating them. Since I load my sprites natively as png files using tiff files with an alpha channel was not an option.

What I ended up doing, was opening my sprites in Photoshop, and under blending options I added a 2px wide white (or whatever color works for you) stroke, with transparency set to 5% and the position set to Outside. This worked very well on almost all of my sprites and it eliminated the black lines.
I’m guessing an even better solution would be to expand your textures by 2px and set the transparency of that to 5%, if you can’t have a slightly visible outline.

If you have exactly lined up tiles and it is happening, for me helped disabling Anisotropic filtering and antialiasing in Quality settings.

5 Likes

thank you mighty sheep! Saved my life.

Thank you so much for this <3

It’s great to show appreciation but please use the Like button rather than necroing a 9 year old post.