All right, I got my GameObject with its animator and several states and parameters.
My “need” is making an animation play while a button is pressed (You press for X seconds the button, the animation plays for X seconds).
So, I got my “Idle state”(IS), my “Playing animation State”(PAS).
The transition from IS to PAS uses a boolean parameter “buttonPressed” and the condition value is “true”.
There’s some code around to handle this, and when the user presses a button, the code executes
Animator.SetBool("Transition", true);
So far, so good: The state jumps from IS to PAS, and the animation starts to play. The problem is that, somehow, the value of the boolean resets, executing the transition from PAS to IS, resetting the state machine and re-executing the transition from IS to PAS.
So, I’m scratching my head on what could be wrong here: Is my approach to keeping the animation playing wrong? I’m ignoring any other “right” way to do this? Should I re-check any value on the animator?