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

Resolved Sprtie looks fine in scene but not in the game

Discussion in '2D' started by HermesTheBird, Jul 24, 2021.

  1. HermesTheBird

    HermesTheBird

    Joined:
    May 2, 2021
    Posts:
    7
    I have 2D pixel art sprites in my game and even though i don't have any compression setting "on" in any of my sprites, almost all of them has this issue. Screenshot_1.png

    Screenshot_2.png

    By the way i just find out unity is doing this in just perticular resolution settings, for example i work on 4:3 and there is sprite corruption but there is no problem with 3:2 or 16:10 settings.
     
    Last edited: Jul 24, 2021
  2. Geejayz

    Geejayz

    Joined:
    Feb 8, 2016
    Posts:
    73
    Hi.

    Two things you should do.
    First try to avoid scaling in on the Game window. This will distort what is actually rendered in the game view.

    upload_2021-7-24_16-28-53.png

    If your sprites are now too small for your expected screen space then adjust your camera size to suit
    upload_2021-7-24_16-30-27.png
    These are just examples by the way but you can see the effect
    upload_2021-7-24_16-31-24.png

    Next, consider that your sprite is actually 16x16 pixels and consider if it makes more sense to have it render with 16 pixels per unit or the default 100...

    upload_2021-7-24_16-33-18.png

    Changing the pixels per unit to 16 will make the sprite appear larger on the screen and you may now have to change your camera size again.

    A combination of the two of these adjustments should resolve your issue. Ideally you want to working with a scale size of 1x in the Game Window
     

    Attached Files:

    HermesTheBird likes this.
  3. HermesTheBird

    HermesTheBird

    Joined:
    May 2, 2021
    Posts:
    7
    Thank you! problem seems to be solved with these tips(though i changed sprite scale instead of camera size because if i change camera size then i would have to change every other thing too) I want to ask one more question, you said using 16 pixels for each unit in game makes more sense for a 16x16 sprite which i agree but what should i do for a 64x32 sprite do we consider vertical or horizontal length? Agan thanks for help.
     
  4. Geejayz

    Geejayz

    Joined:
    Feb 8, 2016
    Posts:
    73
    When you use 16 pixels per unit, you are telling Unity to convert the 16 pixels into one display unit on Unity
    If you expect your 64x32 sprite to appear on the screen as 4x wider and 2x taller than the 16x16 sprite you are using, you should still set it to a unit size of 16 pixels per unit. Hopefully that makes sense.
    If you wanted your 64x32 sprite to fit within one Unity unit you would set its size to 64 pixels per unit.

    For example, in the below screenshot I have two characters, the left character is from a sprite of 16x16 and the right character is from a sprite of 32x64. I have set BOTH to have a pixels per unit of 16
    upload_2021-7-25_16-25-2.png

    If I set the character on the right to 64 pixels per unit, he becomes the same size as the character on the left. upload_2021-7-25_16-26-21.png

    They both occupy a width and height of one Unity unit.

    Mess around with the values and hopefully it will all make sense. Good luck with your projects btw.
     
    HermesTheBird likes this.
  5. HermesTheBird

    HermesTheBird

    Joined:
    May 2, 2021
    Posts:
    7
    Thank you! I'm having trouble with resolution and sprites lately but you helped a lot.
     
    Geejayz likes this.