Search Unity

Floating pixels above my sprite animation

Discussion in '2D' started by batmanistaken, May 18, 2021.

  1. batmanistaken

    batmanistaken

    Joined:
    May 6, 2021
    Posts:
    4
    Making a 2D platformer and just spent ages fixing the camera scaling to fit the pixels. My sprites are a small 16 PPU character and I have a 2 frame idle animation set up for it. I have checked that the 2 images for the animation are not the problem here but when I run it there is extra pixels above its head that moves up and down sometimes. I have attached a short video on youtube that I made to show what I mean.
    Thanks for helping!
     
  2. APSchmidt

    APSchmidt

    Joined:
    Aug 8, 2016
    Posts:
    4,174
    What kind of animations are you using? Are you using the 2D Animation package, adding bones rigged to your sprites? If so, make sure the geometry in the Skinner Editor fits the sprite outline.
     
  3. batmanistaken

    batmanistaken

    Joined:
    May 6, 2021
    Posts:
    4
    Since it's just a small idle animation for now I am not using bones but just 2 different images and using the animator to switch between them. One of my images is the normal sprite and the other is it with its head 1 pixel further down, and I think that the small lines appear when I am in the head down image in the air.
     
  4. APSchmidt

    APSchmidt

    Joined:
    Aug 8, 2016
    Posts:
    4,174
    The pixels above the head are probably pixels that were cut off from the bottom of the sprite; the sprite must have been sliced too tight.

    I remember having this kind of problem in the past, the part of the sprite that had been cut off on the right, was showing on the left in my animation.
     
    batmanistaken likes this.
  5. batmanistaken

    batmanistaken

    Joined:
    May 6, 2021
    Posts:
    4
    Thanks that actually makes a lot of sense! Do you know how I can do that here because I can only make it 16 x 16 pixels. Maybe I can just remake the pixelart file with a space between the images?
     

    Attached Files:

  6. APSchmidt

    APSchmidt

    Joined:
    Aug 8, 2016
    Posts:
    4,174
    Make your sprites with a large space around them; make sure there is actually nothing around the figures and reimport them in Unity. The sprite editor will slice them tight enough to fit the size you want for them. :)
     
    Last edited: May 18, 2021
    batmanistaken likes this.
unityunity