- Home /
idle animation not found
here is my script
var run : AnimationClip;
var idle : AnimationClip;
function Update () {
if (Input.GetKey("a"))
transform.Rotate(Vector3.up * Time.deltaTime * -60);
if(Input.GetKey("d"))
transform.Rotate(Vector3.up * Time.deltaTime * 60);
if (Input.GetKey("w"))
transform.Translate(Vector3.left * Time.deltaTime * 8);
if (Input.GetKey("s"))
transform.Translate(Vector3.left * Time.deltaTime * -4);
if (Input.GetKeyDown("w"))
animation.Play('run');
if (Input.GetKeyUp("w"))
animation.CrossFade('idle', 0.2);
animation.Stop('run');
}
unity says it cant find run or idle so they can not be played, it works if i take out the crossfade part but then the running animation stops with the guys legs not on the ground and it starts again when i move forwards
Comment
Answer by dannyskim · Oct 25, 2011 at 03:41 PM
if (Input.GetKeyDown("w"))
animation.Play('run');
if (Input.GetKeyUp("w"))
animation.CrossFade('idle', 0.2);
animation.Stop('run');
In those three animation calls, you used ( ' ) instead of ( " ) to enclose your strings.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
need animation help 0 Answers
Play an animation just on some parts of the body 1 Answer
Shaking skinned mesh animations 1 Answer
Animation: Impact of combining the use of Layer, CrossFade, and Weight 2 Answers