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. Dismiss Notice

Question Pixels on the Edge of Tiles

Discussion in '2D' started by jonathandw414, Jul 20, 2023.

  1. jonathandw414

    jonathandw414

    Joined:
    Jun 17, 2021
    Posts:
    2
    upload_2023-7-20_21-10-14.png

    How do I fix these lines at the top pf these tiles?
    The tiles are 16x16, and the artefacts are only 1 screen-pixel thick. When turning off the pixel snap, these lines appear as flashes in Game mode.
    Fixes I've tried:
    - The afforementioned pixel snap.
    - Different pivots when slicing the tile map.
    - disabling compression
    - disabling anti ailiasing
    - messing with the camera

    I don't think its a problem with the sprites as they are fine in the scene view and the previews in the editor.
    Any suggestions are much appreciated. :)
     
  2. venediklee

    venediklee

    Joined:
    Jul 24, 2017
    Posts:
    143
    It is probably because your grid and/or object is not at 0,0,0

    You can keep the grid and tilemap where it is and fix the root of the problem by properly using the grid snapping for pixel perfect projects. (your grid snapping is disabled) upload_2023-7-20_23-41-8.png

    After enabling with correct values(check the pixel perfect documentation) it also make sure to select everything in scene and hit align selected

    Edit: also make sure your resolution is not free aspect in game view. Set it to something that is an integer multiple of your base resolution.
     
  3. karderos

    karderos

    Joined:
    Mar 28, 2023
    Posts:
    376
    create sprite atlas with padding = 2
     
  4. jonathandw414

    jonathandw414

    Joined:
    Jun 17, 2021
    Posts:
    2
    >> also make sure your resolution is not free aspect in game view. Set it to something that is an integer multiple of your base resolution.

    Thanks for the help, this worked.

    I'll look into this, I don't really know about sprite atlases. Thanks.
     
    venediklee likes this.