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

Handling Sprites of Varying Sizes

Discussion in 'Animation' started by acecase, Oct 15, 2020.

  1. acecase

    acecase

    Joined:
    Mar 16, 2014
    Posts:
    7
    I keep running in to this problem, and I have been just avoiding assets that don't use a uniform sprite size. However, I just found out about the Liberated Pixel Cup assets, and a great little generator at sanderfrenken.github.io and I love them, but they have this problem.

    Basically, it's that the size of individual frames can be different. For the LPC assets and the output of the generator, most frames are 64x64px and the character is positioned correctly inside of that. However, to make room for the sword, for example, the sword attack animation frames are much larger.

    What that means, as far as I'm aware, is that I can't use the Grid By Cell Size or Automatic options to slice, and I have to set the pivot for each frame manually, so that the sprite doesn't shift when I change animations.

    What I'm doing now is choosing a reference point (the shadow in this example) and manually trying to place the pivot point in the center of that, but it's very time consuming, and I can't help think there is a better way to handle this that I'm just not aware of.

    Thanks
     
  2. acecase

    acecase

    Joined:
    Mar 16, 2014
    Posts:
    7
    I haven't found a solution to this in general, but I found a workaround for this specific case, that makes it manageable. Figured I would post it here in case someone is using the same resources and may find it helpful.

    It wasn't obvious from the spritesheet at first, but the large attack frames at the bottom of the sheets are actually perfectly centered in a grid that is exactly 3x3 of all of the other cells, so if you perfectly crop those frames out alone and import them separately, you can slice by grid (192x192 for the big ones, and 64x64 all the others) and set the pivot in the center, and everything lines up.