When mixing animations of different lengths, they will get out of sync if left to play normally. For example, it could end up with a Walk animation having the left foot on the ground while the Run animation has the right foot on the ground, which would not give a realistic result when simply interpolating between them. This causes obvious issues as you can see in the video below (adapted from the Linear Blending example) when the speed slider is about 75% to the right and the character is walking fine about half the time while the cycles are close to each other but every few steps he does a strange shuffle that looks very unnatural. The solution to this problem is to synchronize the times of each of the states so that they are always at equivalent poses.
|Synchronize Walk and Run
|All animations play independently.
|Walk and Run stay at the same
Enabling time synchronization for all states would give a similar result to the Blend Tree.
Synchronization is good for movement but should usually be disabled for Idle animations.
Blend Trees always synchronize their states, however this is not always ideal so Mixers allow you to choose which states are synchronized. The problem can be seen in the Blend Tree character above video when it blends between Idle and Walk (when the slider is anywhere to the left of the center). Since the Idle animation is much longer than Walk, synchronising them causes the Walk to play far slower than it should so the character barely moves at all until the speed gets above 50% and it starts blending Walk and Run instead. The solution is simply to not synchronize the Idle animation because its poses have no correspondance to any particular times during the Walk animation anyway (which is why the Mixer character gives a much better result at low speed).
When using a Mixer Transition, the
Sync toggles on the right side of the Inspector allow you to choose which of its states are synchronized.
In code, you can control child synchronization like this:
public static void OptionalSynchronizationExample(MixerState mixer)
// By default, all children are synchronized but you can prevent that if you want:
// Note that this only affects children added to a mixer after you set it.
MixerState.AutoSynchronizeChildren = false;
// Disable synchronization for all children.
// Or for a specific child.
// Or enable it for a specific child (if you set AutoSynchronizeChildren = false).
Foot Phase Synchronization
Blend Trees also use a more complex synchronization technique for Humanoid animations known as Foot Phase Synchronization which is described in the following video at 17:10. Essentially, each animation is broken down into phases (right foot down, right foot up, etc.) so that it can properly support animations with irregular walk cycles such as a character with a limp and animations that contain different numbers of walk cycles.
It would be possible to implement Foot Phase Synchronization in Mixers (and you could do it yourself by inheriting from any of the existing mixer types), but Unity's implementation is not exposed publically so it would need to be entirely re-implemented from scratch. It would need the
AnimationClips to be analysed to determine their phases in the Unity Editor since their curves can't be accessed at runtime and then it would need additional logic to adjust speeds at runtime based on that analysis. This could potentially be added to Animancer in the future, but for now it has been deemed to require far too much effort to achieve something that can already be done using a Blend Tree.
The Synchronization system and
Extrapolate Speed feature of
LinearMixerStates work by modifying the speed of the internal
Playables without changing their
AnimancerState.Speed (because they still need to know the base speed they are set to). So the state will show a
Real Speed field in the Inspector whenever its internal speed differs from its