An animated character typically has a number of different movements that are activated in the game in different circumstances. These movements are called Animation Clips. For example, we might have separate animation clips for walking, running, jumping, throwing, dying, etc. Depending on the way the model was animated, these separate movements might be imported as distinct animation clips or as one single clip where each movement simply follows on from the previous one. In cases where there is only a single clip, the clip must be split into its component animation clips within Unity, which will involve some extra steps in your workflow.
The simplest types of models to work with are those that contain pre-split animations. If you have an animation like that, the Animations tab in the Animation Importer Inspector will look like this:
You will see a list available clips which you can preview by pressing Play in the Preview Window (lower down in the inspector). The frame ranges of the clips can be edited, if needed.
For models where the clips are supplied as one continuous animation, the Animation tab in the Animation Importer Inspector will look like this:
In cases like this, you can define the frame ranges that correspond to each of the separate animation sequences (walking, jumping, etc). You can create a new animation clip by pressing (+) and selecting the range of frames that are included in it.
For example:
In the Import Settings, the Split Animations table is where you tell Unity which frames in your asset file make up which Animation Clip. The names you specify here are used to activate them in your game.
For further information about the animation inspector, see the Animation Clip component reference page.
You can create animation clips which animate any object or component property using Unity’s animation window. These animation clips can then be arranged into a state machine in exactly the same way as external animation clips such as character animations. For example, you could animate the motion of a camera, the colour of a light, the individual frames of a sprite animation, or a public property of a script.
To set up a Character or other GameObject for animation, you need to follow this process:
Another way to import animations is to follow a naming scheme that Unity allows for the animation files. You create separate model files and name them with the convention ‘modelName@animationName.fbx’. For example, for a model called “goober”, you could import separate idle, walk, jump and walljump animations using files named “goober@idle.fbx”, “goober@walk.fbx”, “goober@jump.fbx” and “goober@walljump.fbx”. When exporting animation like this, it is unnecessary to include the mesh data in these files, so you should exclude it from the file if your software’s FBX export allows it.
Unity automatically imports all four files and collects all animations to the file without the @ sign in. In the example above, the goober.mb file will be set up to reference idle, jump, walk and wallJump automatically.
For FBX files, simply export a model file with no animation ticked (eg, goober.fbx) and the 4 clips as goober@_animname_.fbx by exporting the desired keyframes for each (enable animation in the FBX dialog).