Version: 2017.2
Masking Imported Clips
Animation events on imported clips

Animation Curves on Imported Clips

Animation curves can be attached to imported animation clips in the Animations tab of the Animation Import Settings.

These curves allow you to add additional animated data to an imported clip, which can allow you to animate the timings of other items based on the the state of an animator. For example, in a game set in icy conditions, an extra animation curve could be used to control the emission rate of a particle system to show the player’s condensing breath in the cold air.

To add a curve to an imported animation, first select the imported animation file in your project view, then in the import settings in the inspector, select the Animations button.

View the Animations section of the Import Settings for your animation file
View the Animations section of the Import Settings for your animation file

Then scroll all the way to the bottom of the inspector to find the Curves heading, among the four fold-out headings as shown:

The curves fold-out heading, along with the Masks, Events and Motion headings
The curves fold-out heading, along with the Masks, Events and Motion headings

Expand the curves heading, and click the plus icon to add a new curve to the current animation clip. If your imported animation file is split into multiple animation clips, each clip can have its own custom curves.

The curves on an imported animation clip
The curves on an imported animation clip

The curve’s X-axis represents normalized time and always ranges between 0.0 and 1.0 (corresponding to the beginning and the end of the animation clip respectively, regardless of its duration).

Unity Curve Editor
Unity Curve Editor

Double-clicking an animation curve will bring up the standard Unity curve editor (see Editing Value Properties for further details) which you can use to add keys to the curve. Keys are points along the curve’s timeline where it has a value explicitly set by the animator rather than just using an interpolated value. Keys are very useful for marking important points along the timeline of the animation. For example, with a walking animation, you might use keys to mark the points where the left foot is on the ground, then both feet on the ground, right foot on the ground, etc. Once the keys are set up, you can move conveniently between key frames by pressing the Previous/Next Key Frame buttons. This will move the vertical red line and show the normalized time at the keyframe; the value you enter in the text box will then set the value of the curve at that time.

Параметры анимационной кривой и контроллера аниматора

Если вы имеете кривую с тем же именем как один из параметров в контроллере аниматора, тогда этот параметр будет принимать значение из кривой в каждый момент времени. Например, если вы сделаете вызов GetFloat из скрипта, возвращенное значение будет равно значению кривой во время вызова. Заметим, что в любой данной точке времени может быть несколько клипов, пытающихся установить один параметр того же контроллера. В этом случае значения кривых нескольких анимаций смешиваются. Если анимация не имеет кривой для какого-то параметра, тогда смешивание будет сделано со значением по умолчанию параметра.

Masking Imported Clips
Animation events on imported clips