This is probably a newbie mistake on my part, but I was trying to follow the animation blending tutorial on the Unity site and I was having an issue getting it to work. I have a model, "MC", and three animations in separate files named "MC@run", "MC@idle", and "MC@jump". All three show up in the animation node of the created MC object for the game, but when I attach my script nothing happens.
function Start ()
{ //Set all animations to loop animation.wrapMode = WrapMode.Loop; //except Jump animation["jump"].wrapMode = WrapMode.Once;
//Put animations into layers
animation["jump"].layer = 2;
animation["run"].layer = 1;
animation["idle"].layer = 1;
animation["run"].weight = 0.1;
//stops animations already playing
animation.Stop();
}
function Update () { //Plays walk or idle based on what key is being pressed if(Mathf.Abs(Input.GetAxis("Vertical")) > 0.1) animation.CrossFade ("run"); else animation.CrossFade("idle");
//Jump
if (Input.GetButtonDown("Jump"))
animation.CrossFade("jump");
}
I've tested all three animations in Unity before trying to blend them and they worked fine. Can anyone help me figure out what's not working here?