Tried different fixes but still having issues with gaps and lines on tilemaps

Hi there, I keep getting a small gap/line inbetween my tiles in my tilemap and though I’ve found many intended solutions online for this, none of the ones I tried worked for me.

Here is the issue:

5820589--616771--Tilemap Lines.png

Here are the things I have tried:

  • Project Settings > Rendering > Anti Aliasing is turned off
  • Tilemap Grid Cell Gap was tried at both 0 and 0.0001 on X and Y, made no difference
  • Made a new material in the Sprites/Default Shader, with Pixel Snap turned on and put it in my tilemap sprite renderers. This almost worked, but I was still getting some lines as shown here:5820589--616774--Tilemap Lines 2.png

So yeah, I’m not really sure what to try at this point. I saw that some people suggest making your sprites one unit bigger on each side but that’s a lot more work than these fixes were so I wanted to see if anyone had any other ideas before I do that. Thanks!

the thing you dont want to do is called padding, but you need to do it.

This is needed because you are using a 3d engine(unity) to render 2d graphics and this will never line up your tiles perfectly unless you create the absolute perfect conditions for it, which is much more troublesome than just adding 1 extra edge of pixels to your sprites.

You can use sprite atlas to add padding automatically.

1 Like

Thanks a lot for the reply! I looked up Sprite Atlas and added one into my project but I’m unfamiliar with this. Is there some direction somewhere as to, or do you know, how to add the padding so I don’t have to do it manually?

I added the tileset file that I’m using for my tilemap to the objects for padding (added the entire sheet, rather than each individual sprite) but nothing seems to have changed and I can’t find any info on what other settings I might need to change.

no problem, you right click on your assets folder and create a new atlas asset, then click on the asset and use the inspector to assign settings, there will be a padding setting, set it to 2, then there will be a parameter to select which assets are packed, you can drag your sprites there. After that you dont have to do anything else and you can use your sprites as normal.

Do add the sprites and not the tilesheet, and you can click pack preview to check how the atlas looks ( it should look buggy if it has padding and not like a clean tilesheet)

1 Like

Ok I’ll start setting this up, thanks a ton for the instructions! Is there a way to add more than one sprite at once? I can’t seem to do it.

put them all in a folder and add the folder, should work like that

1 Like

Awesome! This seems to be working, at least in play mode, edit mode still looks funny but that’s ok, thanks a lot for this!

1 Like