How to make a step forward for each atatck attack?

Good day to all the experts and masters of Unity. I am new to Unity, can someone help me how to set a script to let the player step forward for every attack? Heres my simple flow:


where is attack animation should move a little forward to emphasize the animation. However, what I did before is to add transform property in the animation timeline and animate the values of position for each frame. I realized that at the end of animation clip the position is not anymore set to default (0,0,0) and the ATTACK animation is not anymore allign when it goes back to IDDLE animation.

I am not sure if I did the wrong method or just missing some script. Please let me know or any advise that can help would be more appreciated.


If the problem is that the position of the object after animation is “reset” is because the animation is not set as “Root Motion”.

I recomment you to watch some tutorial about this functionality. ITs exactly what you want. no need code, just the animator.