The Play methods that take a fade duration also have a FadeMode parameter to determine exactly how it works (the FadeMode API page explains each of the modes). That parameter is optional and will use the default FadeMode.FixedSpeed if not specified so the following two lines will do exactly the same thing:
animancer.Play(clip, 0.25f)
animancer.Play(clip, 0.25f, FadeMode.FixedSpeed)
Note that when using Fixed modes, the fade duration is entirely separate from the length of the animation so if the fade is too long it might not even finish fading in by the time the animation ends. This can be avoided by using Normalized modes and ensuring that the value you give is between 0 and 1 because it will be multiplied by the animation's length.
From Start
| Other Modes | FadeMode.FromStart |
|---|---|
| Control how the fade duration is interpreted and will allow an animation to continue from its current time if it was already playing. | Restarts the animation by creating a clone of its State (if necessary) to fade in from the beginning while the old state fades out from its current time, allowing an animation to smoothly transition into itself. |
- If you play a Transition with its
Start Timetoggle enabled, it will useFadeMode.FromStartautomatically. - Cloning any type of state other than a
ClipStatewill logOptionalWarning.CloneComplexState. It's there to ensure that you are aware of the potential performance and behaviour risks but if you are doing so intentionally, feel free to disable the warning like it says. - A clone is created if the existing state's
Weightis above theAnimancerLayer.WeightlessThreshold(default0.1).- If the state and clone have too high
Weight, - If more clones of a particular state would be created than the
AnimancerLayer.MaxCloneCount(default 3), it will instead reuse whichever clone has the leastWeightto limit the potential performance cost.
- If the state and clone have too high
