Creating an animation actually requires a sprite which is kind of weird, but you can always create the sprite, add an animator, then assign the controller to the one you’re editing. I figured out the requirements for this from the Unity animation editor documentation:
- A GameObject must have an Animator component
- The Animator component must have an Animator Controller Asset assigned
- The Animator Controller asset must have one or more Animation Clips assigned
In short, the quickest way to create one, rather than using the Project Window → Right Click -> Create → Animation is to just select the frames you want to animate from your image and drag them onto your scene:
This will create a new .anim
file (your animation) and ask you where to save it. It also sets up a game object with the sprite renderer and animator controller. Just delete the game object from the hierarchy when you’re done. This will also create a new animator controller that will have to be deleted.
Using the Animation Window’s Menu you can Create New Clip… as well, this will add the clip to your animator but not create a new controller. You still have to delete the new clip in the controller to preserve the name if you want to use the same names for all animation keys on all heroes. For example:
Just delete the AyaneWallSlide
clip and wire the NinjaWallSlide
clip to the AyaneWallSlide
clip in the Inspector by changing its Motion property:
Note that depending on how you create the animation clip, the Samples will default to different values. Dragging and dropping from Project to the Scene view seems to set Samples to 12
by default, whereas using the Project Right Click → Create → Animation or Animation Window → Create New Clip… menu seems to default the Samples to 60
:
To make sure your samples are set right make sure to click the ...
in the Animation Window and check Samples: