Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Bug Strange lines when using tilemap

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

  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.
     
    malzaharrr likes this.
  2. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    264
    I ran into this too. Turn off Bilinear filtering on your tilemap textures.
     
  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:
    12
    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!
     
  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:
    16
    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.
     
    Us3rDan and tiddles451 like this.
  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.
     
    OL1V13R likes this.
  10. christh

    christh

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

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