- Home /
Animation works only once on button click
Hello everyone!
The title above sums it up pretty well, but here are some images to explain how the animation works only once on a button click, and to find the reason behind this.
The Animator:
Button OnClick (Image 1), and Animation Inspector (Image 2):
Any help is greatly appreciated!
What is wrong? You call it by button... shouldn't be like that?
Answer by WbrJr · Feb 25, 2018 at 06:54 PM
Hey there,
Seems like I have the same Problem...
But you can just create a simple script for that... should't be too´hard to figure out how ;)
Have a nice day, WbrJr
True, I probably need a script, but don't know what kind of script. I will do some research, but if someone would know the answer that would truly help. Thank you for the answer though.
Someone gave me an answer when I reposted the question: link text
Answer by vanjasretenovic123 · Feb 26, 2018 at 09:47 PM
You can just use
public Animator animator.
void Update() {
if(Input.GetKeyDown(KeyCode.Space))
{
animator.Play("tailanim");
}
}
This is the best way to play animations from Animator!!!