How to make an immediate transition in Mecanim?

Hi. Any help would be greatly appreciated.

In mecanim I have a state called idle and another called attack. idle is a long animation and attack is pretty short. I use a blend tree to blend between the two for smooth animations. The problem is, when I trigger attack, I want the animation to switch to attack immediately. But if attack is trigger in the middle of idle, it waits until the animation hits the preset blending point (the sliders). Is there a way around this?

Select your transition and in the inspector check “Debug” in order to show all options : check “Atomic” to true and set “Transition Duration” and “Transition Offset” to 0.

EDIT : be aware to remove any “Exit time” in your transition, it’s automatically added when you add a transition

When you select the transition from ‘Idle’ to ‘Attack’ in Mecanim, go to the Inspector and change the conditions to make that transition. Make sure that you don’t have ‘Exit time = true’ selected, and change it to any other parameter that you can manipulate from your script. Hope it helps!
If you have any problem, tell me (: