0
\$\begingroup\$

My StateMachine is triggered in a loop as long as transition boolean is true.

I have made sure my code only runs once, where I set the animation bool:

animator.SetBool("talk", true);

This does trigger the transition but the problem is that it re-triggers every frame as long as the bool is true. I had the same issue with a normal state earlier, but there I could turn off "Can transition to self" which solved it. However a StateMachine does not have that option.

I want the animation to play until the bool is set back to false, so using a trigger would not be good here.

enter image description here

EDIT: For some reason it seems the "Transition duration" is the one resetting my animation. So if I change that to 3, it re-enters every 3 seconds, and so on. This seems really weird?

How do I just make sure that the animation plays until its done, then it re-enters (to choose another random talking animation from my StateMachine), as long as talk == true?

\$\endgroup\$
  • \$\begingroup\$ As you set animation from "Any state" and also i think "Has end" is set to false. so every time when bool is true it restart the animation. so i would suggest to use trigger instead of bool. This is just my assumption. \$\endgroup\$ – Swati Oct 11 at 16:59
  • \$\begingroup\$ @Swati I want the animation to loop several times until finished talking, so trigger wont really work. \$\endgroup\$ – Green_qaue Oct 11 at 17:03
  • \$\begingroup\$ then make sure to set "Has End" to true. and exit time to 1. \$\endgroup\$ – Swati Oct 11 at 17:06
  • \$\begingroup\$ @Swati where are you getting "Has End" from? \$\endgroup\$ – Green_qaue Oct 11 at 17:07
  • \$\begingroup\$ sorry it is not "Has End" it is "Has Exit time" sorry my mistake. \$\endgroup\$ – Swati Oct 11 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.