- Home /
Click Once to play an entire animation
Ok, I'm sure there have been a lot of questions about this subject, but when I say:
if(Input.GetMouseButtonDown(0)){
animation.Play("Shoot");
}
And the problem is, I have to hold down the shoot button to play the entire animation, it doesn't matter what kind of playmode it's on. Help Please!!
I'm guessing there's other code that interferes (stops) it. Can you post more code?
Answer by getyour411 · Aug 13, 2013 at 08:12 PM
Is your intent for the user to click and release to play the animation? Try GetMouseButtonUp. If you want them to hold it down, try GetMouseButton.
What I want is to be able to click once and play an animation while I don't have to hold down the mouse button.
Neither of these two solutions work? Simple click of the button, not hold, and the FULL animation plays.
Is this even possible with unity???
Answer by YoungDeveloper · Aug 14, 2013 at 01:37 AM
if(Input.GetMouseButtonDown(0)){
PlayAnimation();
}
void PlayAnimation(){
animation.Play("Shoot");
}
Your answer
Follow this Question
Related Questions
Animate object on mouse button press 1 Answer
adding a player mesh to a fps controller 0 Answers
aiming with animation 1 Answer
Spritesheet animation shake/jitter/wobble problem on android. 1 Answer
OnMouseDown() Doesn't work 17 Answers