How to i go about playing a animation when Left mouse is clicked? C#
i have the animation already and all i need to do is add a script in for the left mouse button can any one show me a small example i could work off of?
here is my script so far
using UnityEngine; using System.Collections;
public class Attack : MonoBehaviour { public Animation anim; void Start() {
}
     void OnMouseDown() {
     anim = GetComponent<Animation>();
     foreach (AnimationState state in anim) {
         state.speed = 0.5F;
     }
 }
}
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Interchangeable animations in a script? 0 Answers
Movement and Jump with animator 0 Answers
When I run this code Unity crashes(ANIMATOR RELATED) 0 Answers
Errors in script when trying to play animation clips 1 Answer
animator and script issue 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                