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:

111952-animator.png

Button OnClick (Image 1), and Animation Inspector (Image 2):

111953-buttonandanim.png

Any help is greatly appreciated!

What is wrong? You call it by button... shouldn't be like that?

4 Answers

4

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 :wink:

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][1] [1]: https://answers.unity.com/questions/1473519/animation-works-only-once-when-button-pressed.html

Here is an answer I got when reposting the question:

Animation works only once when button pressed

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!!!


loop time should be checked in the second picture