Unity has its own built-in Animation Editor and it allows you to edit animations. It's actually very similar to the Animation Editor in Maya. You use curves to edit animations, but it also allows you to do some really cool things with scripts like activate scripts at different points through your animation. So let's take a look and we can see a couple of different techniques to use the Animation Editor. So I'm going to click on Window > Animation, and that's going to bring up our Animation Editor. Now, right now I have nothing selected in my Hierarchy so everything is blank here. I'm going to take a look at my game character, so I'll just click back here to the hierarchy.
And if I think about what is actually animating on my game character-- Let me just going to expand to look at the hierarchy here. The roots, so that's the exoskeleton and that's actually what's being animated as my character moves around. I'll just select root and switch back to my Animation Editor, so now I can see that I have root selected I now have some animation curves here. In my Animation list here, so there is a list all of the animations that are applied to what I have currently selected in the Hierarchy. So I can see that idle, walk, run, and jump animation attached to this component.
And if I scrub through in the timeline here I can play back and forth through that idle animation. Now another thing you might notice is that in this animation list all of these are labeled Read-Only, and if I tried to make any edits here in the Animation window I can't select anything. Everything is kind of grayed-out. So Unity actually prevents you from directly editing the animations that are attached to your character as of imports from Maya. That's actually a good thing because if you were to make edits to the animations here, if you try to open that file backup in Maya it may be corrupted.
So if we want to make changes to the animations attached to our game character we actually need to make a local copy of those animations and that will allow us to both read and write to those animations. So let's look at how we can make a read/write animation for our character. I'll just close out of the Animation Editor here, then in the Project panel I'll look at our Maya file that is our game character, and I'll just look at these animation components. So remember in the previous video we looked at how to set up the FBX Importer to automatically parse out these separate animations.
So I am going to go ahead and make a local copy of this run animation that we can edit inside of Unity. I'll duplicate this just by hitting Command+D. Okay, so there is my copy. I'm going to go ahead and rename this. I will just click Return to rename it. I'll name this Run-RW for run read/write. That will just make it easy to distinguish between this local copy and the read-only copy. And I'll go ahead and make a folder for this. So I'll go Create > Folder. I call this Animations-RW for read/ write, and just left mouse click and drag into that in Animations folder, and then I'll just go ahead and move this to the top level of my project directory.
Okay, so now I have my local copies of animations that I can go ahead and edit as I need to. So let's click back to our game character and in the Inspector take a look at this Animation component. Right now I want to replace that read-only copy with my read/write copy of the run animation. So I'll just click on this selector here and just double-click on run-RW, so that will switch out so that we now have the read/write animation applied to our character.
So back in hierarchy we click on root and bring back the Animation Editor. Now if we select the run read/write animation I can see the curves and now I can also make edits to those curves. So again I can scrub through. I can select the individual curves. So this is the rotation in the Y direction and I'll just grab one of these and drag it way down so we can see how that affects the animation.
And from here I can animate any part of the skeleton that I want. It's a pretty robust animation interface. So in the next video we'll talk about how we can use our read/write animation to call and access scripts.
- Optimizing, extruding, and sculpting geometry
- Modeling a character's head and body
- UV-mapping the head and body
- Mirroring and texturing
- Setting up the skeleton
- Rigging the head and body
- Skin binding & weight painting
- Controlling animation with scripts in Unity