0:00:00.249,0:00:02.445 The animation view allows you to create and 0:00:02.445,0:00:06.040 modify animation clips directly inside Unity. 0:00:06.595,0:00:08.595 It is designed to act as a powerful 0:00:08.595,0:00:10.595 and straightforward alternative to external 0:00:10.595,0:00:12.595 3D animation programmes. 0:00:13.772,0:00:15.772 For instance, if we wanted to have 0:00:15.772,0:00:17.772 a camera fly around a scene to give 0:00:17.772,0:00:20.186 a player an overview of a level 0:00:20.186,0:00:23.313 we can create that animation for it in Unity. 0:00:24.794,0:00:26.794 Here we have a scene with a camera 0:00:26.794,0:00:28.040 in the corner. 0:00:29.018,0:00:31.018 We would like to create an animation 0:00:31.018,0:00:33.512 for that camera which will allow it to move 0:00:33.512,0:00:36.129 from one side of the scene to the other. 0:00:36.965,0:00:38.965 Since we want to make an animation for the 0:00:38.965,0:00:40.965 camera we will want to ensure 0:00:40.965,0:00:43.986 that it is selected in the Hierarchy view. 0:00:44.652,0:00:46.955 We can then open the Animation view 0:00:46.955,0:00:49.356 by clicking Window - Animation. 0:00:50.477,0:00:53.015 Like any other view this is moveable 0:00:53.015,0:00:55.015 resizable and dockable. 0:00:55.805,0:00:57.805 There are many different buttons and options 0:00:57.805,0:01:00.723 visible when you first open the Animation view. 0:01:01.355,0:01:04.862 First and foremost is the animation drop-down. 0:01:04.862,0:01:06.572 Here is where we can select our different 0:01:06.572,0:01:08.252 animations to edit. 0:01:08.906,0:01:11.404 Since we don't currently have any animations 0:01:11.404,0:01:13.404 this drop-down is blank except for the 0:01:13.404,0:01:15.974 ability to create a new animation. 0:01:17.907,0:01:19.907 When you create a new animation you will 0:01:19.907,0:01:22.447 be prompted for a name and a location 0:01:22.447,0:01:24.447 to save the animation file. 0:01:25.140,0:01:27.140 We will create an animation called 0:01:27.140,0:01:29.140 CameraFlyThu and place it 0:01:29.140,0:01:31.140 in the Animations folder. 0:01:32.496,0:01:34.426 The Add Curve button allows us to choose 0:01:34.426,0:01:36.148 which components of our object, 0:01:36.148,0:01:38.148 or any child objects, we wish to modify 0:01:38.148,0:01:40.148 with our animation. 0:01:41.090,0:01:43.020 Each component can be expanded 0:01:43.020,0:01:45.020 to view more options. 0:01:45.520,0:01:47.982 To add a curve click the + sign next 0:01:47.982,0:01:49.692 to the item you wish to add. 0:01:50.192,0:01:52.748 Since we want our camera to fly around the scene 0:01:52.748,0:01:56.847 we will add the transform's position and rotation. 0:01:57.969,0:01:59.969 The timeline is where you will be able to 0:01:59.969,0:02:02.786 establish the timing of your animation. 0:02:02.786,0:02:05.408 The timeline is measured in frames and seconds. 0:02:06.004,0:02:08.152 The red scrubber allows you to choose what 0:02:08.152,0:02:10.152 frame you wish to modify. 0:02:12.171,0:02:14.700 Next is the Record and Play buttons. 0:02:15.085,0:02:16.920 When the record button is pressed 0:02:16.920,0:02:18.529 changes made to the chosen object 0:02:18.529,0:02:21.336 in the Scene view will be added automatically 0:02:21.336,0:02:24.345 to the animation at the currently selected frame. 0:02:25.714,0:02:27.949 The play button will allow you to preview 0:02:27.949,0:02:29.249 your animation. 0:02:30.670,0:02:32.409 The left and right arrows allow you to 0:02:32.409,0:02:34.930 navigate through the keyframes of the animation. 0:02:35.696,0:02:37.847 Next are the buttons which allow you to 0:02:37.847,0:02:39.847 add keyframes and events to the 0:02:39.847,0:02:41.847 currently selected frame. 0:02:42.430,0:02:44.430 The Sample property determines how many 0:02:44.430,0:02:46.747 frames make up one second of animation. 0:02:47.192,0:02:50.618 Reducing this number makes our animations slower. 0:02:52.057,0:02:54.057 At the bottom are two buttons that allow 0:02:54.057,0:02:56.777 you to transition between dope sheet mode, 0:02:56.777,0:02:58.447 which we are currently on, 0:02:58.447,0:03:00.447 and curve view mode. 0:03:01.541,0:03:03.541 With the record button pressed 0:03:03.541,0:03:05.803 it can be very easy to rough out the animation 0:03:05.803,0:03:07.081 that we want. 0:03:07.698,0:03:10.306 Simply select the frame we want to modify 0:03:12.306,0:03:14.802 and rotation in the scene view. 0:03:10.306,0:03:12.306 and then set the desired camera position 0:03:15.306,0:03:17.540 You will notice that a keyframe has been added 0:03:17.540,0:03:20.149 to the timeline with the appropriate values. 0:03:20.883,0:03:22.883 Properties that are currently being animated 0:03:22.883,0:03:25.588 are highlighted in red in the Inspector. 0:03:27.054,0:03:29.941 We can continue doing this for the various phases 0:03:29.941,0:03:31.941 of our fly through animation. 0:03:33.325,0:03:35.463 To preview the animation click the 0:03:35.463,0:03:38.116 play icon next to the record icon 0:03:38.116,0:03:40.116 in the animator view. 0:03:41.776,0:03:44.381 If we were satisfied with our animation 0:03:44.381,0:03:46.381 we could be done now. 0:03:46.381,0:03:49.297 If we wanted to fine tune our animation however 0:03:49.297,0:03:51.717 we would want to look at the curves mode. 0:03:52.253,0:03:55.364 To enter the curves mode select the Curves button 0:03:55.364,0:03:58.082 at the bottom of the animation view. 0:03:59.010,0:04:01.010 Here we can see the various curves of our 0:04:01.010,0:04:03.497 animation by selecting the corresponding 0:04:03.497,0:04:05.677 component on the left. 0:04:05.677,0:04:08.771 Again we can select a frame using the red 0:04:08.771,0:04:10.771 red scrubber on the timeline. 0:04:13.509,0:04:15.605 To modify a value on a curve 0:04:15.605,0:04:17.605 click and drag a keyframe to the new 0:04:17.605,0:04:19.479 desired value. 0:04:19.479,0:04:21.852 To create a new keyframe click the 0:04:21.852,0:04:23.742 Create Keyframe button, 0:04:23.742,0:04:25.742 or double click on the curve. 0:04:26.974,0:04:28.779 Right-clicking on a keyframe will pull up 0:04:28.779,0:04:30.695 some of it's options. 0:04:30.695,0:04:32.695 the most notable of these options is the ability 0:04:32.695,0:04:34.695 to choose Free Smooth. 0:04:35.278,0:04:37.830 This will create two handles are the keyframe 0:04:37.830,0:04:39.830 which you can use to smooth the curve 0:04:39.830,0:04:41.830 to your liking. 0:04:42.786,0:04:44.786 Another way to control our curves is to 0:04:44.786,0:04:46.786 choose the Broken option. 0:04:47.949,0:04:49.687 This allows you to control each side of the 0:04:49.687,0:04:51.687 keyframe indecently. 0:04:52.960,0:04:55.400 In this example we will want to add 0:04:55.400,0:04:56.986 a little variance to the exposition 0:04:56.986,0:04:58.791 of the transform. 0:04:58.791,0:05:01.205 Doing so will give us more of a weightless feel 0:05:01.205,0:05:03.205 to our animation. 0:05:04.492,0:05:07.323 Again we can do so by creating keyframes 0:05:07.323,0:05:09.323 on the exposition curve and changing 0:05:09.323,0:05:11.323 our values manually. 0:05:13.356,0:05:16.192 The animations created in Unity have the same 0:05:16.192,0:05:18.555 Inspector settings as animations made 0:05:18.555,0:05:20.237 in external programmes. 0:05:20.654,0:05:22.403 We can see these by selecting our clip 0:05:22.403,0:05:24.636 in the Project view. 0:05:24.636,0:05:26.319 Since we want our camera to fly across the 0:05:26.319,0:05:29.278 screen only once, we best uncheck 0:05:29.278,0:05:31.278 are Loop Time property. 0:05:32.441,0:05:34.828 It is interesting to note that an animator 0:05:34.828,0:05:36.828 is in charge of animation playback for generic 0:05:36.828,0:05:39.463 objects the same as it is for humanoids. 0:05:40.184,0:05:42.184 Unity has automatically added the 0:05:42.184,0:05:44.543 animator to our camera and created an 0:05:44.543,0:05:47.113 animator controller, a state machine 0:05:47.113,0:05:49.113 and added it to this component 0:05:50.000,0:05:52.477 The clip we just created is added to the 0:05:52.477,0:05:54.477 state machine as the default clip 0:05:54.477,0:05:56.477 that would be played at runtime. 0:05:57.695,0:05:59.695 This means we can go on to record 0:05:59.695,0:06:01.695 other clips and use the animator 0:06:01.695,0:06:03.695 to decide when to play them. 0:06:04.195,0:06:06.473 In this manner, once our animation clip 0:06:06.473,0:06:08.952 is completed we can run our scene 0:06:08.952,0:06:10.952 to see it in action.