- Home /
Question by
AlfAtUnity · Oct 28, 2012 at 04:14 PM ·
animation problem
How to loop animation from code?
Need to make animation looping (without setting looping from editor). animation.play("walk"); - but it's not looping
Comment
glance at the documentation page for "Animation" and it will immediately tell you
Answer by farooqaaa · Oct 28, 2012 at 05:14 PM
animation.wrapMode = WrapMode.Loop;
Please check the documentation before posting a question.
Answer by ReubenXXX · Aug 02, 2017 at 12:18 AM
And here is a good solution 5 years later in unity 5:
this.GetComponent<Animation>()["Walking"].wrapMode = WrapMode.Loop;
//Walking is just the name of the animation
Your answer
![](https://koobas.hobune.stream/wayback/20220613083008im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Plsss help :( plsss -1 Answers
Animation doesn't affect the new instantiated object. 0 Answers
Animation Not Playing when Imported. 0 Answers
Animation only partially plays 0 Answers
Animation Bug?, 1 Answer