Original Post: My Old Blog
Animations: A Unity 5 Approach
This post will include a small amount of information regarding Animations in the Unity 5 engine. Keep in mind I won’t go into full detail about how everything works. I’ll be mainly focusing on the Animator component for simplicity sake.
In Unity 5, there are components you can add to your Game Objects to allow for animations of sprites or 3D models. I will be showing you 2D animation, because that is what my game was using. Before you run into this blindly, there are three terms you need to know to make animations in Unity work on the component level:
-Animator: The component you attach to a Game Object that stores the information and interface to control your animations
-Animation Clip: The actual animation frames/rigs that you are using
-Animation Controller: The thing that handles all your animation clips in the form of a state machine, and the thing you pass into the animator component to allow interaction through code manipulation to handle animations.
Refer to this picture below for the things I need to explain:

When you create an animation clip and drag it into a unity scene, it will automatically create an animation controller to go along with it (highlighted in green here). If you don’t want that, create your own controller with your own naming convention, and add the clips later. Naming your spritesheets beforehand for clips is crucial, because you cannot change them in the editor once they are made. My sprite sheets, clips, and controllers are highlighted in the blue section.
Once you have all your clips made, drag them into the animator window, you’ll see them either as grey or orange blocks like in the green highlighted area. You’ll also notice a green and red block labelled Entry and Exit respectively. These are the states of your controller that are when you enter and exit the state machine if no other states can be transitioned to. The orange state is the state that the animation controller goes to upon entry, so be wary of which one you place there (keep it to an idle state if you have them).
The arrowed lines that you see connecting the clips together are the animation transitions. These are the transitions you as a programmer decide that the animations can go between at runtime using Parameters (highlighted in red) and transition forms (highlighted in purple). You can have as many conditions as you feel necessary to prevent transitioning into an incorrect state, but keep in mind that All transition conditions must be true in order to transition to that state. If there are no available states to transition to, the controller will exit and reenter, if you have that state connected to the exit transition. How you create your state machine is up to you, but make sure there are no loose ends or you won’t get a satisfactory animator.
The transition conditions you make in the controller can be accessed through code via the Animator component you attach to your Game Object that you want to animate. There is more depth to the amount of things you can do with your animations, including layers, and transition timings between states, but I did not need to use those aspects for my particular project.
If you want more information or help with how 2D animations are handled in Unity, please refer to this in-depth tutorial here: http://michaelcummings.net/mathoms/creating-2d-animated-sprites-using-unity-4.3