The animation view allows you to create and
modify animation clips directly inside Unity.
It is designed to act as a powerful
and straightforward alternative to external
3D animation programmes.
For instance, if we wanted to have
a camera fly around a scene to give
a player an overview of a level
we can create that animation for it in Unity.
Here we have a scene with a camera
in the corner.
We would like to create an animation
for that camera which will allow it to move
from one side of the scene to the other.
Since we want to make an animation for the
camera we will want to ensure
that it is selected in the Hierarchy view.
We can then open the Animation view
by clicking Window - Animation.
Like any other view this is moveable
resizable and dockable.
There are many different buttons and options
visible when you first open the Animation view.
First and foremost is the animation drop-down.
Here is where we can select our different
animations to edit.
Since we don't currently have any animations
this drop-down is blank except for the
ability to create a new animation.
When you create a new animation you will
be prompted for a name and a location
to save the animation file.
We will create an animation called
CameraFlyThu and place it
in the Animations folder.
The Add Curve button allows us to choose
which components of our object,
or any child objects, we wish to modify
with our animation.
Each component can be expanded
to view more options.
To add a curve click the + sign next
to the item you wish to add.
Since we want our camera to fly around the scene
we will add the transform's position and rotation.
The timeline is where you will be able to
establish the timing of your animation.
The timeline is measured in frames and seconds.
The red scrubber allows you to choose what
frame you wish to modify.
Next is the Record and Play buttons.
When the record button is pressed
changes made to the chosen object
in the Scene view will be added automatically
to the animation at the currently selected frame.
The play button will allow you to preview
your animation.
The left and right arrows allow you to
navigate through the keyframes of the animation.
Next are the buttons which allow you to
add keyframes and events to the
currently selected frame.
The Sample property determines how many
frames make up one second of animation.
Reducing this number makes our animations slower.
At the bottom are two buttons that allow
you to transition between dope sheet mode,
which we are currently on,
and curve view mode.
With the record button pressed
it can be very easy to rough out the animation
that we want.
Simply select the frame we want to modify
and rotation in the scene view.
and then set the desired camera position
You will notice that a keyframe has been added
to the timeline with the appropriate values.
Properties that are currently being animated
are highlighted in red in the Inspector.
We can continue doing this for the various phases
of our fly through animation.
To preview the animation click the
play icon next to the record icon
in the animator view.
If we were satisfied with our animation
we could be done now.
If we wanted to fine tune our animation however
we would want to look at the curves mode.
To enter the curves mode select the Curves button
at the bottom of the animation view.
Here we can see the various curves of our
animation by selecting the corresponding
component on the left.
Again we can select a frame using the red
red scrubber on the timeline.
To modify a value on a curve
click and drag a keyframe to the new
desired value.
To create a new keyframe click the
Create Keyframe button,
or double click on the curve.
Right-clicking on a keyframe will pull up
some of it's options.
the most notable of these options is the ability
to choose Free Smooth.
This will create two handles are the keyframe
which you can use to smooth the curve
to your liking.
Another way to control our curves is to
choose the Broken option.
This allows you to control each side of the
keyframe indecently.
In this example we will want to add
a little variance to the exposition
of the transform.
Doing so will give us more of a weightless feel
to our animation.
Again we can do so by creating keyframes
on the exposition curve and changing
our values manually.
The animations created in Unity have the same
Inspector settings as animations made
in external programmes.
We can see these by selecting our clip
in the Project view.
Since we want our camera to fly across the
screen only once, we best uncheck
are Loop Time property.
It is interesting to note that an animator
is in charge of animation playback for generic
objects the same as it is for humanoids.
Unity has automatically added the
animator to our camera and created an
animator controller, a state machine
and added it to this component
The clip we just created is added to the
state machine as the default clip
that would be played at runtime.
This means we can go on to record
other clips and use the animator
to decide when to play them.
In this manner, once our animation clip
is completed we can run our scene
to see it in action.