- Home /
 
Animation by click
How can i activate an animation by clicking with the mouse, for example, an animation of a sword swinging
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Joyrider · Aug 20, 2013 at 09:41 PM
If you had an animation component with a clip called swordSwing on your object
 void Update()
 {
    if(Input.GetMouseButtonDown(0))
          animation.Play("swordSwing");
 }
 
              Answer by ChEsKo · Aug 21, 2013 at 12:05 PM
Thank you very much, this was indeed very usefull, tho I couldnt use void, but instead I used function, I dont know much about programming, could the reason be that your anwser was based in another language?
Im working on java
nevertheless the logic did help me.
Thanks!
Your answer