Stop Animation and switch to another state

Hello, i have an animation controller where i have defined all states. Idle (default state), walk and eat. Now i have a Trigger “StartWalking” which is set from idle → walk transition.

This worked, but the state is changed after the idle animation is finished. My idle nimation goes about 5 seconds so when my ant start to walk the state changing needs up to 5 seconds.

Is there a way to stop the idle animation and switch at the time the button is pressed?

Yes: uncheck the “Has Exit Time” box. See section 3.1 of 2D Animation Methods in Unity. (Even if you’re doing 3D animation, much of the info in this article still applies, particularly sections 2 and 3.)