How to invert a 2D animation

Hello Unity Community!

I’m almost started to learning Unity. I’m making a basic 2D game and I have a problem with animations. I have done all scripting and animations for basic movements (idle, walk, jump) but when I walk backward it’s still playing the walk forward animation.

What should I do? I know it’s a stupid question but I have tried to scale x -1 on local parameters but it doesn’t work, the player (gameobject) appears on other x position.

I need a solution to fix this. Can somebody help me? Thanks you

You can try this. Its working for me to reverse my sprites running annimation when he turns the other way… Its’ from this video. He explains how it works around the 42 minute mark.

https://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers

void flip ()
{

	facingright = !facingright;
	Vector3 theScale = transform.localScale;
	theScale.x *- = 1;
	transform.localScale = TheScale;	


}