Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Strange lines when using tilemap

Discussion in '2D Experimental Preview' started by WolfMountainGames, Oct 1, 2016.

Thread Status:
Not open for further replies.
  1. WolfMountainGames

    WolfMountainGames

    Joined:
    Apr 7, 2016
    Posts:
    16
    When I use the tilemap editor I get lines everywhere like this: TileLines.PNG
    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.
     
    Kokowolo and malzaharrr like this.
  2. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    I ran into this too. Turn off Bilinear filtering on your tilemap textures.
     
    audiovoid likes this.
  3. WolfMountainGames

    WolfMountainGames

    Joined:
    Apr 7, 2016
    Posts:
    16
    When using pixel art I always use "point(no Filter)", this is what it would look like in bilinear: Bilinear.PNG

    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.
     
  4. WolfMountainGames

    WolfMountainGames

    Joined:
    Apr 7, 2016
    Posts:
    16
    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....
     
  5. AndressMartin

    AndressMartin

    Joined:
    Jun 24, 2017
    Posts:
    15
    Sorry for necroing this thread, but did you find a fix?
     
  6. guiguimanu

    guiguimanu

    Joined:
    Mar 6, 2017
    Posts:
    17
    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!
     
    F4dl and Greenfox21 like this.
  7. cuproPanda

    cuproPanda

    Joined:
    Apr 20, 2014
    Posts:
    2
    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. triangle4studios

    triangle4studios

    Joined:
    Jun 28, 2020
    Posts:
    33
    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. Zak_Mellor18

    Zak_Mellor18

    Joined:
    Sep 15, 2019
    Posts:
    1
    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.
     
    jk238400 and OL1V13R like this.
  10. christh

    christh

    Joined:
    Jun 9, 2019
    Posts:
    10
    This solved everything for me, thanks.

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

    Greenfox21

    Joined:
    Oct 14, 2021
    Posts:
    1
    Thanks. I had that same problem. The camera fixed this easily.
     
  12. sakkikasper

    sakkikasper

    Joined:
    Jul 14, 2020
    Posts:
    1
    Won't this make everything look considerably thicker with something as small as 16x16 pixel art?
     
  13. SuperllamaSplat

    SuperllamaSplat

    Joined:
    Jun 26, 2022
    Posts:
    1
    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
     
  14. ComputerCables

    ComputerCables

    Joined:
    Jun 21, 2017
    Posts:
    5
    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
     
    rohcatman likes this.
  15. Kingstad

    Kingstad

    Joined:
    Aug 10, 2023
    Posts:
    1
    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!:
     
  16. Gusts92

    Gusts92

    Joined:
    Oct 13, 2015
    Posts:
    18
    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...
     
    Last edited: Jan 4, 2024
Thread Status:
Not open for further replies.