Pivot Points - How to make them consistent?

I’ve been working in Unity 2D for most of my time working in Unity, and I have found that 2D animations are a mess to implement for one reason: PIVOT POINTS.

This is due to the fact that pivot points are based around the slice section on a given sprite instead of around its animation or around its actual sprite size. For instance, if you a hand-drawn animation that you want to import, you’ve gotta slice it up and put it in the animation section like you normally would, but you also have to rigorously and continually go back into the sprite editor in order to fix and/or modify screwed up pivot points for each and every frame of the animation.

The only method I have found to make them work even halfway consistently is to set the pivot point to the bottom right corner, then edit it for any changes in individual sprite sizes. This is cumbersome and time-consuming in the extreme, sometimes taking upwards of an hour for longer animations.

Does anyone know of a better/faster way of consistently keeping the pivot point in the correct spot? I have already looked for some answers and found nothing really useful. Any help would be greatly appreciated.

When you say “correct,” is this something that a program can deduce? What I mean is, without editing the pivot point itself, how do you suppose that Unity should figure out what “correct” in a certain case means?

In my top-down game, my pivots are on the bottom, but up a bit on the y axis (0.125, etc.). For certain frames (not too many yet), yes, the pivot would have to be manually set. (This is for y-sorting mostly.)

Programmatically it is possible to tell, but you’d have to input the total size of the animation, which is where things get tricky. Finding the pivot point of an animation and making sure all the slices have the same one is the easy bit. The hard part is telling Unity where the animation starts and ends on a sprite sheet and how many slices to make in between. There’s a lot of stuff to manually set, but it is possible to pull off and it’d make it easier than hand-setting every friggin’ pivot point.

Unity docs have this part, but i dont understand how to call this parametr.

Maybe I’m missing something here, but can’t you just drag the animation frames onto the animation timeline? The first frame is where it starts and the last frame is where it ends.

I’m having the same issues with mine, several years later. Did you ever find a way to do this easier?

The process will somewhat depend on your drawing workflow and software and may require making some adjustments to it.
If you are drawing the frames using computer → make sure to correctly configure the export options so that all frames have the same size. When splitting the spritesheet into frames don’t use Automatic mode, split either use split grid by cell size or cell count. Then aligning pivots should be as easy as setting them all to the same corner, or entering the same coordinates. If done correctly no additional per frame adjustments should be necessary.

If you want pivot in specif coordinates for game programming reasons, manually entering them for each frame by hand can be a bit tedious even if it’s the same number for all frames. I remember there was a forum post where Unity was collecting feedback on what sprite multi editing features people would want to see. But for now that can be automated using editor script, there are also a few existing asset store extensions which helps with the same thing if you don’t want to make your own editor script.

If you are worried that have all frames the same size wastes a lot of space, that can be later recovered by creating a sprite atlas (using unity builtin functionality). It’s much easier to tightly pack sprites after importing into Unity instead of importing already tightly packed sprite sheet.

If during export your drawing software tries to minimize the size of each frame, then all the alignment is lost, so try to avoid this at all cost and configure export options correctly. If you are working with an existing spritesheet that you downloaded somewhere form internet and wasn’t crated with alignment considerations in mind then your only options are: spend the time finding better sprite sheet or spend the time manually aligning each frame.

If you are hand drawing on a piece of paper then things are a bit more complicated. I am not too familiar with the process with hand drawing animation process (on paper). I guess you could achieve somewhat similar process if you draw each frame on separate sheet of paper so that stacking sheets on top of each other results in aligned images. Then when you scan the drawn images make sure to carefully position paper in the corner of scanner. That should produce similar result as exporting same size frames from computer drawing software as mentioned before. Rest of the steps should be as before.
As for keeping the sheets aligned during drawing I would expect that to be part of animation drawing process (you should know that better than I do). If you are drawing in flipbook all the pages should already be aligned. Assuming you cut the flipbook appart to make scanning easier, align pages using corners that are furthest away from cut/glue side. If you are drawing on individual sheets against light box, some of them have alignment pins. If yours don’t you could still tack two corners of paper using tape to keep the sheets aligned while drawing. Even if you didn’t properly align pages during drawing I guess you could align them against lightbox afterwards and then cut square before scanning.

Remember that little bit of preparations before drawing can save you a lot of time afterwards.