[Solved]There is a delay between setInteger and the animation

I have an animation that is called through “Any state” in Animator. The transition have HasExitTime unchecked, and the transition is called after setting a variable called “injured” to 1.

The problem is that when I set that “injured” parameter to 1 through my personal script Animator Controller using setInteger(“injured”,1), sometimes the animation have a delay, and sometimes it doesn’t have that delay.

I’m sure that the parameter “injured” is setted to 0 after the animation have been played through a StateMachineBehaviour, and the parameter of make transition with himself is unchecked too (to make sure it’s called once).

The setting of the parameter is done through OnCollisionEnter, and maybe the combination of updates of PhysX and Animations is problematic.

It’s important for my game to have an instant player reaction, to have 0,1 seconds of delay sometimes is a problem.

The problem was because the tranitions. When the parameter is setted to 1 in the middle of a Transition, if you have [None] in the Interruption Source parameter of the Settings from transition, the animation wont be played until that transition ends. I’ve solved this setting all the Interruption Source from all Transitions to “Next State”.