Animation Clips are the smallest building blocks of animation in Unity. They represent an isolated piece of motion, such as RunLeft, Jump, or Crawl, and can be manipulated and combined in various ways to produce lively end results (see Animation State MachinesA graph within an Animator Controller that controls the interaction of Animation States. Each state references an Animation Blend Tree or a single Animation Clip. More info
See in Glossary, Animator ControllerControls animation through Animation Layers with Animation State Machines and Animation Blend Trees, controlled by Animation Parameters. The same Animator Controller can be referenced by multiple models with Animator components. More info
See in Glossary, or Blend Trees).
You can select Animation Clips from imported FBX data.
When you click on the model containing animation clips, these properties appear:
There are four areas on the Animation tab of the InspectorA Unity window that displays information about the currently selected GameObject, Asset or Project Settings, alowing you to inspect and edit the values. More info
See in Glossary window:
(A) Asset-specific properties. These settings define import options for the entire Asset.
(B) Clip selection list. You can select any item from this list to display its properties and preview its animation. You can also define new clips.
(C) Clip-specific properties. These settings define import options for the selected Animation Clip.
(D) Animation preview. You can playback the animation and select specific frames here.
These properties apply to all animation clips and constraints defined within this Asset:
Property: | Function: | |
---|---|---|
Import Constraints | Import constraintsSettings on Joint components which limit movement or rotation. The type and number of constraints vary depending on the type of Joint. More info See in Glossary from this asset. |
|
Import Animation | Import animation from this asset. Note: If disabled, all other options on this page are hidden and no animation is imported. |
|
Bake Animations | Bake animations created using IK or Simulation to forward kinematic keyframes. Only available for Autodesk® Maya®, Autodesk® 3ds Max® and Cinema 4D files. |
|
Resample Curves | Resample animation curves as Quaternion values and generate a new Quaternion keyframe for every frame in the animation. This option is enabled by default. Disable this to keep animation curves as they were originally authored this only if you’re having issues with the interpolation between keys in your original animation Only appears if the import file contains Euler curves. |
|
Anim. Compression | The type of compressionA method of storing data that reduces the amount of storage space it requires. See Texture Compression, Animation Compression, Audio Compression, Build Compression. See in Glossary to use when importing the animation. |
|
Off | Disable animation compressionThe method of compressing animation data to significantly reduce file sizes without causing a noticable reduction in motion quality. Animation compression is a trade off between saving on memory and image quality. More info See in Glossary. This means that Unity doesn’t reduce keyframeA frame that marks the start or end point of a transition in an animation. Frames in between the keyframes are called inbetweens. See in Glossary count on import. Disabling animation compression leads to the highest precision animations, but slower performance and bigger file and runtime memory size. It is generally not advisable to use this option - if you need higher precision animation, you should enable keyframe reduction and lower allowed Animation Compression Error values instead. |
|
Keyframe ReductionA process that removes redundant keyframes. More info See in Glossary |
Reduce redundant keyframes on import. If enabled, the Inspector displays Animation Compression Errors options. This affects both file size (runtime memory) and how curves are evaluated. Only for Generic Animation Type rigs. |
|
Keyframe Reduction and Compression | Reduce keyframes on import and compress keyframes when storing animations in files. This affects only file size: the runtime memory size is the same as Keyframe Reduction. If enabled, the Inspector displays Animation Compression Errors options. Only for Legacy Animation Type rigs. |
|
Optimal | Let Unity decide how to compress, either by keyframe reduction or by using dense format. If enabled, the Inspector displays Animation Compression Errors options. Only for Generic and Humanoid Animation Type rigs. |
|
Animation Compression Errors | Only available when Keyframe Reduction or Optimal compression is enabled. | |
Rotation Error | Set the error tolerance (as an angle in degrees) for rotation curve compression. Unity uses this to determine whether or not it can remove a key on a rotation curve. This represents the minimum angle between the original rotation value and the reduced value: Angle(value, reduced) < RotationError
|
|
Position Error | Set the error tolerance (as a percentage) for position curve compression. Unity uses this to determine whether or not it can remove a key on a position curve. For more information, see Setting error tolerance for key reduction on position and scale curves. | |
Scale Error | Set the error tolerance (as a percentage) for scale curve compression. Unity uses this to determine whether or not it can remove a key on a scale curve. For more information, see Setting error tolerance for key reduction on position and scale curves. | |
Animated Custom Properties | Import any FBX properties that you designated as custom user properties. Unity only supports a small subset of properties when importing FBX files (such as translation, rotation, scale and visibility). However, you can treat standard FBX properties like user properties by naming them in your importer script via the extraUserProperties member. During import, Unity then passes any named properties to the Asset postprocessor just like ‘real’ user properties. |
Set the error tolerance percentage to determine whether or not Unity can remove a key on a position or scale curve as a strategy for animation compression.
When you set the Anim. Compression property to “Keyframe Reduction” or “Optimal”, Unity compares the original curve to what the curve looks like after removing a specific keyframe and applies this test:
OriginalValue - ReducedValue > OriginalValue * percentageOfError
Unity removes a keyframe if the delta between the original value and the reduced value is less than the original value multiplied by the error tolerance percentage.
Note that the Unity compares the distances between the three curve components (that is, it compares distance(x,y,z)
), and also per component ( distance(x)
, distance(y)
, and then distance(z)
).
This example demonstrates how Unity evaluates a reduction on the y-axis using an error tolerance of 10%:
Keyframe A has a value of 11.2:
Keyframe B has a value of 11.1:
The resulting reduced curve looks like this:
Keyframe A is not reduced because:
D = 11.2 - 10 = 1.2
.E = 10% * 11.2 = 1.12
Keyframe B is reduced because 11.1 - 10 < 10% * 11.1
:
D = 11.1 - 10 = 1.11
E = 10% * 11.1 = 1.11
Note that this method has a limitation when using high values that vary only slightly. Moving the SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary 1000 units away results in essentially the same animation but located far from 0.
In this case, both keyframes are reduced.
Keyframe A is reduced because:
D = 1011.2 - 1010 = 1.2
E = 10% * 1011.2 = 101.12
Keyframe B is reduced because 11.1 - 10 < 10% * 11.1
:
D = 11.1 - 10 = 1.11
E = 10% * 1011.1 = 101.11
Higher values require a much larger difference between the original and reduced values for keyframes to remain in the reduced curve. Keyframe A has a value of 1100 and is discarded; keyframe B has a value of 1112 and remains:
You can perform these tasks in this area of the Animation tab:
+
) button.-
) button.Warning: If you manually change any properties of the imported clips, Unity will not import new animation clips when the source Asset changes. For example, if you create a new clip or change a clip’s timing on the Animation tab, that clip list will not change even if you add clips to the FBX file outside of Unity. Unity will ignore the new animation clips.
This area of the Animation tab displays these features:
(A) The (editable) name of the selected clip
(B) The animation clip timeline
(C) Clip properties to control looping and pose
(D) Expandable sections for: defining curves, events, masks, and motion roots; and viewing messages from the import process
You can set these properties separately for each animation clip defined within this asset:
Property: | Function: | |
---|---|---|
Area A (editable name) | ||
The take in the source file to use as a source for this animation clip. This is what defines a set of animation as separated in Motionbuilder, Autodesk® Maya® and other 3D packages. Unity can import these takes as individual clips. You can create them from the whole file or from a subset of frames. |
||
Area B (timeline features) | ||
You can use the drag the start and end indicators around the timeline to define frame ranges for each clip. | ||
Start | Start frame of the clip. | |
End | End frame of the clip. | |
Area C (looping and pose control) | ||
Loop Time | Play the animation clip through and restart when the end is reached. | |
Loop Pose | Loop the motion seamlessly. | |
Cycle Offset | Offset to the cycle of a looping animation, if it starts at a different time. | |
Root Transform Rotation | ||
Bake into Pose | Bake root rotation into the movement of the bones. Disable to store as root motionMotion of character’s root node, whether it’s controlled by the animation itself or externally. More info See in Glossary. |
|
Based Upon | Basis of root rotation. | |
Original | Keep the original rotation from the source file. | |
Root Node Rotation | Use the rotation of the root node. Only available for the Generic Animation Type. |
|
Body Orientation | Keep the upper body pointing forward. Only available for the Humanoid Animation Type. |
|
Offset | Offset to the root rotation (in degrees). | |
Root Transform Position (Y) | ||
Bake into Pose | Bake vertical root motion into the movement of the bones. Disable to store as root motion. | |
Based Upon (at Start) | Basis of vertical root position. | |
Original | Keep the vertical position from the source file. | |
Root Node Position | Use the vertical root position. Only available for the Generic Animation Type. |
|
Center of MassRepresents the average position of all mass in a rigidbody for the purposes of physics calculations. By default it is computed from all colliders belonging to the rigidbody, but can be modified via script. More info See in Glossary |
Keep center of mass aligned with the root transform position. Only available for the Humanoid Animation Type. |
|
Feet | Keep feet aligned with the root transform position. Only available for the Humanoid Animation Type. |
|
Offset | Offset to the vertical root position. | |
Root Transform Position (XZ) | ||
Bake into Pose | Bake horizontal root motion into the movement of the bones. Disable to store as root motion. | |
Based Upon | Basis of horizontal root position. | |
Original | Keep the horizontal position from the source file. | |
Root Node Position | Use the horizontal root transform position. Only available for the Generic Animation Type. |
|
Center of Mass | Keep aligned with the root transform position. Only available for the Humanoid Animation Type. |
|
Offset | Offset to the horizontal root position. | |
Mirror | Mirror left and right in this clip. Only appears if the Animation Type is set to Humanoid. |
|
Additive Reference Pose | Enable to set frame for the reference pose used as the base for the additive animation layer. A blue marker becomes visible in the timeline editor: |
|
Pose Frame | Enter a frame number to use as the reference pose. You can also drag the blue marker in the timeline to update this value. Only available if Additive Reference Pose is enabled. |
|
Area D (expandable sections) | ||
Curves | Expand this section to manage animation curves on imported clips. | |
Events | Expand this section to manage animation events on imported clips. | |
MaskCan refer to a Sprite Mask, a UI Mask, or a Layer Mask More info See in Glossary |
Expand this section to manage masking imported clips. | |
Motion | Expand this section to manage selecting a root motion node. | |
Import Messages | Expand this section to see detailed information about how your animation was imported, including an optional RetargetingApplying animations created for one model to another. More info See in Glossary Quality Report. |
Creating clips is essentially defining the start and end points for segments of animation. In order for these clips to loop, they should be trimmed in such a way to match the first and last frame as best as possible for the desired loop.
If any problems occur during the animation import process, a warning appears at the top of the Animations Import inspector:
The warnings do not necessarily mean your animation has not imported or doesn’t work. It may just mean that the imported animation looks slightly different from the source animation.
To see more information, expand the Import Messages section:
In this case, Unity has provided a Generate Retargeting Quality Report option which you can enable to see more specific information on the retargeting problems.
Other warning details you may see include the following:
These messages indicate that some data present in your original file was omitted when Unity imported and converted your animation to its own internal format. These warnings essentially tell you that the retargeted animation may not exactly match the source animation.
Note: Unity does not support pre- and post-extrapolate modes (also known as pre- and post-infinity modes) other than constant, and converts these to constant when imported.
The preview area of the Animation tab provides these features:
(A) The name of the selected clip
(B) The 2D preview mode button (switches between orthographic and perspective camera)
(C) The pivot and mass center display button (switches between displaying and hiding the gizmos)
(D) The Avatar selector (change which GameObject will preview the action)
(E) The play/pause button
(F) The playback head on the preview timeline (allows scrubbing back and forth)
(G) The animation preview speed slider (move left to slow down; right to speed up)
(H) The playback status indicator (displays the location of the playback in seconds, percentage, and frame number)
(I) The TagA reference word which you can assign to one or more GameObjects to help you identify GameObjects for scripting purposes. For example, you might define and “Edible” Tag for any item the player can eat in your game. More info
See in Glossary bar, where you can define and apply Tags to your clip
(J) The AssetBundles bar, where you can define AssetBundles and Variants