I’m currently working on my first 2D platform for a game jam. And we’ve set up an auto-tiler to help speed up level design. But we had this weird issue where we got lines in between the tiles. The fix was fairly easy: a sprite atlas. So today, I’ll walk you through our process and how we corrected the lines between tiles.

For reference, here is an image of our testing level. Notice between several of the tiles we have this obnoxious gap between the tiles.

Lines between tiles without sprite atlas

Sprite Texture Import Settings

First, make sure your import settings are set up correctly for your project.

Sprite texture import settings

Here, you can see we’ve set our sprite mode to multiple since we are using a sprite sheet. Pixels per unit is set to 8 since our sprites are 8×8 pixels. Because we are using pixel art and don’t want that blurry effect around the edges, filter mode is set to Point (no filter). And finally, we’ve disabled compression.

In our case, we using the 2D Tilemap Extras package for the auto-tiler. Using the sprite editor, the sprite sheet is sliced and pulled into a rule tile. The rule tile is then placed in a tile palette.

Note, the 2D Tilemap Extras package is not part of the standard Unity registry. To use it, you need to first Enable Preview Packages under Project Settings > Package Manager. Then, install the 2D Tilemap Extras package within the Package Manager.

Setting Up the Sprite Atlas

Once you ensure all your sprite textures are set up properly for your project, you can try setting up a sprite atlas. In your Project panel, right click. Select Create > 2D > Sprite Atlas.

After you have the sprite atlas in your project, click on it to pull it up in the inspector. Near the bottom, you’ll see a dropdown called “Objects for Packing”. Add each of your sprites to this array and you should see the lines between your tiles go away.

Setting up the sprite atlas
Lines between tiles with sprite atlas

Conclusion

Getting lines between our tiles was kind of an annoying problem. Setting up the sprite atlas was a super easy fix. And hopefully it fixes your issue, too.

But truthfully, I’m not sure why this work. What exactly a sprite atlas is and how it makes the lines go away isn’t clear to me. And that bothers me a little bit. I usually like to understand a tool before just using it blindly. But since we’re on a time limit for the game jam, I will be delaying my research until the jam is complete.

Did using a sprite atlas help correct your issue? Do you understand more about sprite atlases and can share your wisdom with us? Let us know in the comments below.

Categories: Unity