To animate Game Objects in Unity, the object or objects need an Animator Component attached. This Animator Component must reference an Animator Controller, which in turn contains references to one or more Animation Clips.
When using the Animation View to begin animating a GameObject in Unity, all these items will be automatically created, attached and set-up for you.
To create a new Animation Clip for the selected GameObject, and make sure the Animation Window is visible.
If the GameObject does not yet have any Animation Clips assigned, you will see the “Create” button in the centre of the Animation Window timeline area. Click the Create button. You will then be prompted to save your new empty Animation Clip somewhere in your Assets folder.
Once you have saved this new empty Animation Clip, a number of things happen automatically:
The result of this automatic sequence is that all the required elements of the animation system are set up for you, and you can now begin animating the objects.
If the Game Object already has one or more Animation Clips assigned, the “Create” button will not be visible. Instead, one of the clips will be visible in the animation window. You can switch between which Animation Clip is visible in the window by using the menu in the top-left of the Animation window, just under the playback controls.
If you want to create a new Animation Clip on an object that already has animations, you must select “Create New Clip” from this menu. Again, you will be prompted to save your new empty Animation Clip before being able to work with it.
While the above steps automatically set up the relevant components and references, it can useful to understand which pieces must be connected together.
The diagram below shows how these pieces are assigned, starting from the new animation clip created in the Animation Window:
In the image below, you can see a GameObject selected (“Cube”) that is not yet animated. We have just a simple cube, with no Animator component. The Animation, Hierarchy, Project and Inspector windows are arranged side-by-side for clarity.
By pressing the create button in the Animation view, a new animation clip is created. Unity will ask to pick the name & location to save this new Animation Clip. Unity also creates an Animator Controller asset with the same name as the selected GameObject, adds an Animator component to the GameObject, and connects the assets up appropriately.
In the new view above, you can see: