Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Unity's Tilemap problem, some gaps between tiles.

Discussion in '2D' started by esteban16108, Dec 7, 2018.

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

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    159
    Hi all.

    Unity 2018.3.0b12

    So I'm making this small game with Unity Tilemaps and I found that when the Camera moves there are gaps you can see, only when the camera moves and they flicker.

    Any way to fix it?

    Attached a screenshot and marked some but you can see many of them around.

    BTW, the Spritesheet is already as Filter Mode: Point (no filter)

    Any help appreciated.

     
    Bakanovskiy95 likes this.
  2. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    899
    Are you using a Sprite Atlas for the sprites? If not, try it, it usually fixes gaps.
     
    apilatosba, preislter, Alemo and 2 others like this.
  3. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    159
    If I create an Atlas I would have to recreate the Tile Palette ... and I then have to recreate the maps?
     
  4. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    899
    No, you shouldn't have to recreate anything. Just use, Create an Sprite Atlas (in Unity, don't redo your graphics in an other tool or something) and then point the Sprite Atlas to your sprites. Nothing should change, except that Unity will automatically use the sprites from the Atlas.
     
  5. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    159
    Well that worked! Thanks a lot.

    Any idea why?
     
  6. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    899
    It's to do with how the edges are handled with ordinary sprites and atlased ones. In the Atlas there is additional padding around the sprites.
     
  7. Jack-Howard

    Jack-Howard

    Joined:
    Jan 17, 2015
    Posts:
    1
    Thanks. This worked for me too.
     
  8. lolthedropper

    lolthedropper

    Joined:
    Jan 23, 2020
    Posts:
    1
    Thank you so much!
     
  9. drandev

    drandev

    Joined:
    Mar 23, 2020
    Posts:
    10
    Thanks so much!
     
  10. OzyBear

    OzyBear

    Joined:
    Jan 12, 2018
    Posts:
    2
    Thank you very much, this solution still work like a charm.
     
  11. amarnaman

    amarnaman

    Joined:
    Mar 27, 2014
    Posts:
    5
    Nice! I was fixing this in previous versions of Unity (pre 2020) by setting the X and Y grid sizes in the Grid to 0.999 each but this stopped working in v2020 and the sprite atlas method works like a charm. Also, no need to redo any of the scene! I simply created the Sprite Atlas and included the tileset asset in the Objects for Packing field of the new sprite atlas. All grid glitches fixed!
     
    Vevaan-Verma likes this.
  12. kal3d

    kal3d

    Joined:
    Jan 24, 2016
    Posts:
    1
    Thank you! That saved a lot of my time.
     
  13. SamTech1712

    SamTech1712

    Joined:
    Nov 4, 2020
    Posts:
    1
    hey I saw your answer but can anybody tell how to do in a detail or some screenshots
     
  14. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @SamTech1712

    "can anybody tell how to do in a detail or some screenshots"


    Simply google: unity create sprite atlas step by step

    And you'll get several video tutorials that show you how to create a sprite atlas.
     
  15. All_American

    All_American

    Joined:
    Oct 14, 2011
    Posts:
    1,528
    What sprites from map box do you pack in the atlas? if it is generated at runtime?
     
  16. RicardoSousaBR

    RicardoSousaBR

    Joined:
    Sep 20, 2015
    Posts:
    1
    Wow! This worked wonderfully for me. Thank you very much!
     
  17. unity_217halukszn

    unity_217halukszn

    Joined:
    Sep 23, 2020
    Posts:
    1
    i fix problem with creating a new tilemap right behind the broken tiles and when gap appears background tiles fill them up.
     
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,724
    That is not a fix and nobody should willingly reduce the performance of their application to do that. All you're doing is hiding it in the worst possible way.
     
  19. Deleted User

    Deleted User

    Guest

    this helped me :)
     
  20. vandel212

    vandel212

    Joined:
    May 10, 2020
    Posts:
    24
    I made a tool for adding a 1px padding to tile sheets a couple years ago. I made a post here for it, but it never occurred to me to reply to other people's posts haha. It's not the flashiest program in the world, but it gets the job done. If you run into any bugs, let me know and I'll see if I can fix it. https://github.com/Vandel212/Unity2DTileSetPaddingExtruder
     
  21. Alemo

    Alemo

    Joined:
    Jan 12, 2018
    Posts:
    2
    Worked for me too! Thank you!
     
  22. TwoGether

    TwoGether

    Joined:
    Apr 6, 2015
    Posts:
    3
    Not sure if this is still valid but this worked for me. (Unity 2020.3)
    1. Select your Grid settings
    2. Then change the default setting for "Cell Gap" from -0.0005 (or whatever values you had) to 0.007 or enter values that would bring the tiles closer.
    3. You can easily adjust while in Play Mode then pause and see what values work.

    upload_2022-11-2_10-27-52.png
     
    OmarVector likes this.
  23. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    159
    This is a hack,.... If you use Sprite Atlas it will be fixed instantly without need for this kind of negative gap
     
  24. WMaC51

    WMaC51

    Joined:
    Dec 23, 2022
    Posts:
    2
    I'm relatively new to unity and I have a sprite sheet with all of the tiles/sprites I just put in the atlas. The atlas fixed my problem immediately even though I already had them all together in a sheet. When you slice a sprite sheet does it save them to memory individually? Because I thought they were still referenced as a child of the sprite sheet.
     
  25. AngryProgrammer

    AngryProgrammer

    Joined:
    Jun 4, 2019
    Posts:
    490
    Often, small gaps can also appear in the game preview. Then just set the resolution to match your screen.
     
  26. NeoArkangelus

    NeoArkangelus

    Joined:
    Jan 31, 2021
    Posts:
    1
    I just sign in to say I love you, man, really helpful.
     
  27. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    144
    This is exactly how did you save my ass:D

    Thanks man

    I used atlas, but never fixed the issue , you need to test on variation screen resolution to validate that the line gab issue no longer exist, and this hack was the only one worked perfect
     
  28. apilatosba

    apilatosba

    Joined:
    Mar 11, 2022
    Posts:
    4
    thank you
     
  29. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,488
    Hi,
    Please don't necro post.
    If you want to show appreciation use the Like button.
    Thread locked.
     
Thread Status:
Not open for further replies.