There are three main parts to using animations in Unity:

  1. Animation - Essentially the video clip you will play
  2. Animator - This is a component you put on the character. It is a flowchart that handles which animation clip to play when.
  3. A Script - This is the main way to control the Animator, though there are ways to animate your character without any code.

Open the Animator and Animation Windows

From the top menu, make sure that both your "Animation" and "Animator" windows are open.

    • Top Menu --> Window --> Animation --> Animation
    • Top Menu --> Window --> Animation --> Animator

Giving the Player an Animator Controller

  1. In the "Project" window, right click and select
    • Right Click --> Create --> Animator Controller
    • Give it a clear name, such as "PlayerAnimator"
  2. In the "Hierarchy" window, select the GameObject you wish to animate. Add the component "Animator".
  3. With the character selected, you will notice that the field "Controller" currently says none. Drag your "PlayerAnimator" into this field.
  4. All you need now are some Animation Clips to play

Note: Unity will automatically do this for you when you create your first Animation Clip (next step) while selecting a GameObject in the Hierarchy. I just feel like it is helpful to understand how to do it yourself.

Creating an Animation Clip

  1. While selecting the player GameObject in the Hierarchy, look at the "Animation" window
  2. In the middle of the Animation window is a "Create" button. Click this button and give your new animation clip (like a video clip) a clear name such as "Player_Idle"
  3. Organize your new Animation Clip and Animator Controller in your Project folder, so it isn't cluttered. Such as creating an "Animation Clips" folder, with subfolders for each different animated character or GameObject.
  4. Notice two things:
    • Your "PlayerAnimator" now has a new "State", or animation clip, to play in its flowchart
    • Your Animation window now has a timeline and options for this specific animation clip

Recording an Animation Clip

You can directly record changes to most any attribute of any GameObject component. For example, you can have the x- and y-scale of your character change in an animation to make it wobble a little bit. You can change the z-rotation in an animation to make a wheel spin. You can change the color of the sprite renderer over time to show sunrise to sunset. Below is a brief explanation of how.

  1. Select the appropriate GameObject in the Hierarchy, and look at the "Animation" window. Make sure the correct animation is selected (in the top left of the Animation window, under "Preview").
  2. Click "Add Property" and select the property you wish to change over time in your animation. For example, you want a tree to gently sway from side to side, so you select:
    • Add Property --> Transform --> Rotation (click plus sign)
  3. Click the red circular "Record" button
  4. Click your mouse on the timeline where you want to set a value. For example, I want to set the rotation at the starting time (0:00), so I click on 0:00 and the tall white slider bar goes to that point in the animation clips timeline. Then go up to the Transform and set the rotation values.
    • Note: The timeline is in 60ths of a second. So 0:30 is half of a second. 1:00 is one second.
  5. Click on an ending (furthest rotation) value in time. For me, I will click on 1:00 (one second into the animation timeline). Go up to the Transform component and change the rotation to the end extreme value of your desired rotation. For me, i will tilt the tree 10 degrees.
  6. Repeat for all the key endpoints. Mine are below:
    • 0:00 - rotation (0,0,0)
    • 0:30 - rotation (0,0,10)
    • 1:00 - rotation (0,0,0)
    • 1:30 - rotation (0,0,-10)
    • 2:00 - rotation (0,0,0)
  7. Click the red circular "Record" button to stop recording when you have finished.

Hit play to see it in action. Since this is the only animation you have (you don't have a static unmoving animation clip), your player will start the game doing this animation on loop.

Editing the Tweening Curve

Unity will automatically smooth out the "tweening" between the key values that you set when recording your animation. In other words, the animation will automatically rotate the tree smoothly from (0,0,0) to (0,0,10) in a half of a second)

If you don't want Unity to automatically choose "tween" method to use to smoothly go between your key moments in the animation clip, you can edit the curve yourself.

I find this useful to smooth out the start and end of my animation clips, in case the loop doesn't look smooth going from run to jump, or rotating one way to resting.

Some Great Animation Resources:

Brackey's Videos on Animation

BlackThornProd Videos on Animation

Google Slides I made Last Year

These walk you through how to navigate between animations using scripting. One thing I never got to adding to the slides are "Trigger" parameters. Triggers are essentially just boolean values that automatically switch back when the animation is done. This can be really useful for things like "attack". Trigger the onetime animation clip and let it automatically untrigger. It is a parameter datatype just like boolean or float, and you code it the same way except for you don't need to pass in a value. Instead of "anim.SetBool("walking", true);" you simply write "anim.SetTrigger("Attack");". You still need to create transitions in your Animator that use this as the condition.

13.0 Basic Animations (App and Game Design)

Skeletal Animation is Here!

Published Nov, 2018. You need 2018.3 or better to use these tools.

Some Great Animation Resources:

Brackey's Videos on Animation

  1. 2D Animation in Unity (22min, Aug 2018)
  2. How to make a 2D Platformer - 2D ANIMATION (21min, Jul 2014)
  3. Unity Tutorial, 3D ANIMATION (9min, Nov 2013)

Miscellaneous Other Videos

  1. "Animation 101 - Intro to Animation in Unity" by Makin' Stuff Look Good - A 10min video from March 2016 that walks you through much of what is in the tutorial above.'
  2. "Playing Animation on Trigger in Unity" ( 9min, Jan 2019) - A YouTube tutorial by SpeedTutor that goes through how to plan an animation when you land on a trigger (OnTriggerEnter) using a Boolean variable. Walks you through much of what is in the tutorial above in a quick smooth fashion.
  3. "Rig and Animate 2D Characters in Unity 2018" (23min, Oct 2018) by Sykoo. A video on how to rig up a skeleton 2D character made of many sprites, then animate how they move together.
  4. "How to Create Animations from Models and Sprites within Unity" - A webpage tutorial on by Jesse Glover. It is a very thorough walkthrough using a few 3D humanoid models.
  5. "Simple 2D Sprite-sheet animations in Unity" - A webpage tutorial on It walks through turning a 2D sprite sheet into an animation, the coding, the sprite editor and the animator flowchart.

Overall Tips on Creating a Great Animation