- Home /
Question by
kevinrocks_786 · Aug 18, 2015 at 09:04 PM ·
animation2dunity5
Animation not playing Unity 5 (2D)
So I made a simple animation, just made a bunch of sprites and dragged them to my timeline. I made a few lines for it to move right and play the animation but it's not working. The console shows 0 errors. It's moving to the right, but the animation isn't playing. I also marked the animation as legacy like it told me to. It is still not working. Heres my code.
#pragma strict
var moveSpeed = 5;
var jumpSpeed = 5;
function Update () {
if (Input.GetKey(KeyCode.D))
{
GetComponent.<Animation>().CrossFade("DoodleRun");
GetComponent.<Rigidbody2D>().velocity.x = moveSpeed;
}
else {
GetComponent.<Rigidbody2D>().velocity.x = 0;
}
}
Comment
Isnt crossfade supposed to move between 2 anims? If theres nothing already playing you cant crossfade to something else. Am I wrong here?
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Select Animations Freezing on First Frame 1 Answer
how to make a basic 2d animation 1 Answer
Unable to play animation continuously? 1 Answer
Unity 5 Broken Animations? 3 Answers