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

Unexpected sprite tearing?

Discussion in '2D' started by DugelStudios, Oct 23, 2015.

  1. DugelStudios

    DugelStudios

    Joined:
    Feb 21, 2015
    Posts:
    92
    I making a 2d game and I am having some very random problems... My sprites are not displaying as they should be. Below is a screen shot of what I see when I run my game. This bug is present in the game window and the scene window, both when the game is running and not running. And the glitch is not because of the tiles being offset (The background is made up of tiles), if you look closely the player sprite is also glitched up. I have tried restarting unity and my computer, one of which has worked. I have been having this problem ever since i started using tilesets (using one PNG image and cropping out smaller sprites by setting the sprite mode to multiple, instad of using just one PNG image where there is only one sprite and the sprite mode is singular). How do I fix this?
     

    Attached Files:

  2. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    556
    do you have padding around your player sprites? If not, you should at least have a 1px repeated border
     
    Last edited: Oct 23, 2015
  3. DugelStudios

    DugelStudios

    Joined:
    Feb 21, 2015
    Posts:
    92
    By padding, do you mean that I should have a 1px transparent space between all my sprites on my spritesheet? If that is the case, I thought i have seen other people use sprites that are packed together without any space.
     
  4. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    556
    This is probably related to clamping. Try just repeating the outside border of the sprite. I can't remember why this happens...only that in some cases, unity samples outside the sprite bounds. This is a much better explanation of the issue.
    http://gamedev.stackexchange.com/qu...textures-picking-up-edges-of-adjacent-texture

    EDIT: You could also try changing the wrap mode to "repeat" in the advanced settings of the sprite importer.