Search Unity

Bug Tiles have little gaps only through camera

Discussion in '2D' started by On-Stand-By, May 24, 2023.

  1. On-Stand-By

    On-Stand-By

    Joined:
    Sep 30, 2017
    Posts:
    16
    Hi,
    I'm setting up a project and I have a problem with the tilemap :
    upload_2023-5-24_17-49-45.png
    There's tiny gaps that appears depending on the camera's position and aspect ratio.
    Pixel Perfect Camera component is present on the camera, Asset PPU set to the same as the sprite. Sprite filter mode set to Point and no compression.
    upload_2023-5-24_17-53-44.png
    Run in Editor Mode clearly show there's something off but I can't find what.
    It doesn't occur with every tiles, the dark ones doesn't behave like this.

    Can you help me?

    Thank you !
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,439
    Your Game tab is set to Scale 1.1x, does it look right when you drag the slider all the way left to 1.0x?
     
  3. On-Stand-By

    On-Stand-By

    Joined:
    Sep 30, 2017
    Posts:
    16
    Yes the scale doesn't change anything.
    It looks like some tiles are getting moved down by 1 pixel for some reason
    upload_2023-5-24_19-13-55.png
     
  4. FaithlessOne

    FaithlessOne

    Joined:
    Jun 19, 2017
    Posts:
    318
    Did you used a sprite atlas with at least padding of 2 pixels for all sprites/tiles shown?
     
  5. On-Stand-By

    On-Stand-By

    Joined:
    Sep 30, 2017
    Posts:
    16
    Isn't sprite atlas used mostly to reduce draw calls?
    Forgot to tell but I use a spritesheet so it's in Multiple mode :
    upload_2023-5-25_9-34-47.png
    Creating a sprite atlas didn't changed anything, until I pressed play and Unity decided to do it's magic. It's weird that in all tutorial for pixel perfect game nobody was talking about sprite atlas (too obvious to tell?).
    Thank you! :)
     
    Last edited: May 25, 2023
  6. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    602
    It's not that the sprite atlas by itself helps directly -> it's the option to add additional colored padding during creation of sprite atlas. There are other ways to add padding and achieve the same result without Sprite Atlas, but the sprite atlas is quick and easy way to do it without requiring to make major changes to your workflow.

    You might want to look at this response giving more examples https://forum.unity.com/threads/why...at-certain-screen-sizes.1402474/#post-8822728