Animation Exasperation
(TLDR: I created a sweet script that means I don't have to do 300+ steps for our future game jams, find the link to the script below)
Goal: Add 1 new character to our Isometric Game in Unity

Steps:
- Create sprite strip (make sure all cells are the same width and height)
- Import
Texture2Dinto Unity - Set
Sprite Modeto Multiple - Click
Sprite Editorbutton (don't forget to save the changes to Sprite Mode) - Click the
Sliceoption in the top menu - In the
Typedropdown, selectGrid by Cell Size - Enter
16for width (Pixel size X) and32for height (Pixel size Y) - Click the
Slicebutton - Repeat steps 1-8 for each direction your character is facing for both
Walkanimations andStandanimations (total of 8 sprite strips) - Take a deep breath, because you are not even half way done
- Right click your Animation folder in your explorer and create a new
Animator Controller - Click on your
AnimatorControllerand open up theAnimatortab in the Unity Editor - Right click in your Animation folder again and create a new
Animation - Make sure to name your
Animationobject based on the sprite sheet it is going to be associated with (DownLeftWalk, DownLeftStand, UpRightWalk, UpRightStand, etc...) - Click and drag the newly created
Animationinto theAnimatortab window that you have open - Repeat step 13-15 for each of your sprite sheets
- Now create an empty
GameObjectin your scene (or you can use a prefab) - Add the
SpriteRendererandAnimatorcomponents - Drag the
AnimatorControllerfrom step 11 into theAnimator.Controllerslot - Open up the
Animationtab (different fromAnimatortab) while you have theGameObjectselected (that part is important) - Now you should have a dropdown in the
Animationtab that has your list ofAnimation's, if not, go back to step 20 and try again - Select one of the
Animationsfrom the drop down - Navigate to the folder you have your actual sprite sheet asset in
- Click the little arrow to open up your sprite sheet and show all of the individual sprite frames in the explorer
- Shift-Click to select all of the frames out of the sprite sheet
- Drag the frames from the explorer and drop them into the
Animationtab - You should see the frames listed one-by-one in the
Animationtab - Click the play button in the
Animationtab to view the animation (don't forget to navigate back to theSceneview) and you can now adjust the speed of the animation by changing theSamplesnumber in theAnimationtab - Repeat steps 22-28 for all of your
Animationsfor this character - (Optional) Our animations looped, so you need to go into each
Animationobject and selectLoop TimeandLoop Pose
No biggy. Now just do this entire process 13 times (1 for the player character, and 12 more times for each NPC).

In total, I spent just shy of 3 hours working on this task for our jam (not including the time to actually make the sprite sheet, that part was done by our artist, or the part where I had to actually LEARN how to make all this stuff work in the first place). This list, I feel, really highlights the downside to using Unity for our animation framework. There is just such an incredible amount of overhead to get just a single animation into the game. And honestly, since we only do this process once every few months, one of us has to relearn it all from scratch each time. We've probably all, during one jam or another, sat there reading through Unity docs and watching youtube tutorials trying to figure out how to configure everything just right so that Unity will allow us to play our 2D animations.
I'm sure there is a really great use-case for such a complex animation system somewhere in 3D land, but for all of us who are using Unity in just 2 dimensions, we could really use a better process for this. So, after this jam was over, I decided to investigate how it could be done.
AssetPostprocessor to the rescue!
In Unity, you can set up an Asset processing pipeline where scripts are run when specific types of Assets are imported into the project. After much fiddling, I've found a half-way-decent approach to automate MOST of the busy work.
Check out my gist to get the full file: https://gist.github.com/Kenoshen/494a83028e8c6509087172c21fefcef4 (put it in Assets/Editor)
Instead of doing that entire list manually, this script will run every time you import a new sprite sheet into the project. It slices the texture (given some texture naming conventions), creates the AnimatorController and each Animation, adds the frames of the sprite sheet into the Animation, and adds the Animation to the AnimatorController. All together reducing your work down to dragging the appropriate AnimatorController into the correct GameObject Animator component.
If you were like our team and were constantly battling with Unity's Animation system, I hope this script helps you in your future work.
Good luck and happy Jamming!
PS. Check out our game: 2nd Bank
