How i can play a animation only once when i press a key?,hit only once animmation
hi i have a little question how i can to hit only once, when i hold pressing left mouse button the animation of hit stay in loop and what i want is that when i keep press left mouse button or press left mouse button play all the hit annimation and then back to the idle animation,hi i have a little question how i can to hit only once, when i hold pressing left mouse button the animation of hit stay in loop and what i want is that when i keep press left mouse button or press left mouse button play all the hit annimation and then back to the idle animation
Answer by tormentoarmagedoom · Feb 03, 2019 at 01:06 PM
Buenas,
You only need to detect the key press with getButtonDown(). Its only executed the frame you click it.
So when detected you only need to
Animation.Stop(); // Optional if pretend to reactivate the animation every time you click
Animation.Play();
Then you need to have that animation NOT selected as loop.
Bye!
Your answer
Follow this Question
Related Questions
How to play and hold on a single frame of an animator clip 1 Answer
Unable to play Death Animation. Parameters missing? 1 Answer
my animation isnt importing, and the mesh stays on the T pose 0 Answers
Animation length longer than animation curve 0 Answers
after press resume animation on the game still stopped 0 Answers