Animation.SyncLayer

function SyncLayer (layer : int) : void

Description

Synchronizes playback speed of all animations in the layer.

When blending between two looping animations they often have different lengths. For example a walk cycle often takes longer than a run cycle. When blending between them you need to make sure that the foot placement of the walk and run cycle happens at the same time. In other word playback speed of the animations must be adjusted so that the animations are synchronized. SyncLayer will calculate the average normalized playback speed of all animations in the layer based on their blend weight. Then it will apply that playback speed to all animations in the layer.

JavaScript
// Puts the walk and run animation in the same
// layer and synchronizes their speed
animation["walk"].layer = 1;
animation["run"].layer = 1;
animation.SyncLayer(1);

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Example() {
animation["walk"].layer = 1;
animation["run"].layer = 1;
animation.SyncLayer(1);
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Example():
animation['walk'].layer = 1
animation['run'].layer = 1
animation.SyncLayer(1)