- Home /
Animation looping
Hi there and thanks for looking. I have a code that works great but the only thing is i want to loop the walk animation and when the key is released stop the animation here's the code below.
function Awake()
{ animation["Idle"].layer = 0; animation["Run"].layer = 1; animation["Jump"].layer = 2; }
function Update() { if (Input.GetKey("a")) { animation.CrossFade("Run"); } else { animation.CrossFade("Idle"); }
if (Input.GetKey("d")) { animation.CrossFade("Run"); } else{ animation.CrossFade("Idle"); }
if (Input.GetButtonDown("Jump")) { animation.CrossFade("Jump"); } else{ animation.CrossFade("Idle"); }
}
Your answer

Follow this Question
Related Questions
How can i make this animation play only once? C# 1 Answer
animation loop around constantly 1 Answer
Loop animation issue. 2 Answers
button animation loop unity 2D 0 Answers