Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

TileMap Gaps and Tears

Discussion in '2D' started by Salient, Jun 10, 2019.

  1. Salient

    Salient

    Joined:
    Jul 19, 2015
    Posts:
    3
    I'm having issues with my 2d tilemap. When the camera moves, I see gaps or tears on the tilemap.

    Capture33333.JPG

    I have found a couple of solutions that work some of the time:
    One is to set a negative cell gap on the tile grid.
    The other is to make use of another sprite material with pixel snap checked.

    With the negative cell gap, I still occasionally see issues when the camera moves.

    Pixel snap is inconsistent, it seems to work perfectly for awhile, then the problem returns.

    Does anyone know why this is happening? And if there is a better solution to the problem?
     
  2. Primoz56

    Primoz56

    Joined:
    May 9, 2018
    Posts:
    369
    this is happening because of scaling issues, you will experience them pretty much all the time. i use a canvasscaler object to rescale my tiles and its generally good. either way you'll need to have something that will produce a consistent size for your tiles (either that or your actual images might have these little lines in there, such as from antialiasing/blurring, or you're cutting too deep into the other tile (instead of cutting 0->49 you cut 0->50).
    negative cell gap will hide/mask the problem but a proper solution (if you're able to find it) will eliminate it altogether. note that negative cell gap will cause stretching/blurring issues.
     
  3. Salient

    Salient

    Joined:
    Jul 19, 2015
    Posts:
    3
  4. ranjansikand

    ranjansikand

    Joined:
    Apr 8, 2021
    Posts:
    103
    This reply is super late, but I found an easy fix to this issue. In the grid, simply change the gap between tiles to something like -0.01. This way, they're slightly overlapping, so there's no gap to be spoken of. It could mess up tile-based games once you get further away from the origin, but for most of my situations this has worked.
     
  5. SansPapyrus683

    SansPapyrus683

    Joined:
    May 8, 2020
    Posts:
    8
    Where's this "gap" option? I don't see anything like it in my options:
    upload_2022-7-5_17-2-24.png
     
  6. AegeanK

    AegeanK

    Joined:
    Aug 1, 2022
    Posts:
    2
    Screenshot 2022-08-02 123639.png

    It'll be on your tilemap's parent grid, not the tilemap itself.
     
  7. AegeanK

    AegeanK

    Joined:
    Aug 1, 2022
    Posts:
    2
    Worked like a charm, thanks!