Strange lines when using tilemap

When I use the tilemap editor I get lines everywhere like this:


And if I change the zoom on the camera or on in the scene the lines change… I am not sure exactly how to fix this, but I do remember that in a previous version there was a similar bug like this.

2 Likes

I ran into this too. Turn off Bilinear filtering on your tilemap textures.

1 Like

When using pixel art I always use “point(no Filter)”, this is what it would look like in bilinear:

Often just changing it to point helps as
Point filtering - texture pixels become blocky up close.
Bilinear filtering - texture samples are averaged,
but I think that this is something else.

I tried turning off anti-aliasing and turning on pixel snap and that fixed it in the game view… for now, but in the scene view, there is a vertical line in between every row…

Sorry for necroing this thread, but did you find a fix?

This is a common problem in making 2d tile based games. It isn’t Unity specific and the solution is usually to add a pixel bleed around the edge of each sprite in your spritesheet.

I recommend googling spritesheet bleed.

Hope this helps!

2 Likes

What fixed it for me was going into the Package Manager and enabling ‘2D Pixel Perfect’. 2D Pixel Perfect gives you a Pixel Perfect Camera script which you can add to any rendering cameras, fixing the tile tearing.

8 Likes

When you import your image, set your pixels per unit to one pixel lower than the actual ppu. This will create an automatic bleed that forces your tiles to overlap and removes the lines.
The cause of this is that you end up seeing some of the next tile in the map as you move.
Because of this, always try to pad your tiles with an extra pixel around the edges that blends well.

9 Likes

I also set my pixel per unity of my tilemap lower. Though one lower wasn’t big enough for me I tried 5 lower and that seemed to fix it.

2 Likes

This solved everything for me, thanks.

And on another test, so did this. Thanks a lot!

Thanks. I had that same problem. The camera fixed this easily.

Won’t this make everything look considerably thicker with something as small as 16x16 pixel art?

Hey, I may be a year late to this comment but I wanted to say thanks! It worked perfectly, and reading the other comments I was worried that I would have to redo all of my sprites xD

A simple fix for the tilemap tearing is: 1. Create a new material 2. Set material shader to “Sprites/Default” 3. Check “Pixel snap” 4. Assign the material to the Tilemap Renderer Material slot for each tilemap

2 Likes

I’ve just picked up unity/programming less than a week ago and I dont even understand what you guys are saying but this guy seems to have the most painless and quick fix one could want!:

1 Like

I tried everything on this thread and am still with the same problem. 8 years now and no solution?

EDIT: Nevermind, the sprite atlas thing solved it. FFS, that’s so convoluted…

1 Like