# Unity: Flip Sprite Direction

I'm toying around with the new Sprite class in Unity, and I'm trying to work out how to change the direction the sprite is facing ("flip" it). I'm sure I can most likely just scale it across the x axis by -1, but I'd just like to know if there's a new, "official" way of doing it with Sprite or SpriteRenderer. Thanks!

• flip the texture Dec 9, 2013 at 6:19
• Note that simple flipping leads to ambidextrous sprites, which may or may not be appropriate for the game you're making. If you want to avoid that, you'll either need a perfectly symmetric sprite, or a seperate (set of) sprites for the reverse direction. Dec 10, 2013 at 10:45

Looks like the "official" way is to just invert the scale across the x axis. (That's how it's done in the 2D project example, so I think it's safe to assume there's no fancier way of doing it.)

You should aim to keep the scale of your "containers" like the root of the character at (1,1,1). So I recommend having the sprite as a child of the gameobject, you don't want changing the scale of the sprite affecting the collider for example. Then flip the scale of that child.

• I second this, when scaling the x your rotations will reverse as well. If you want to flip the sprite and save yourself a lot of headache, make it a child and scale the child's x to -1. Mar 7, 2014 at 16:33

Like others said, you can flip the x value of the local scale:

var direction = 1; //  or -1, depending which way you want the sprite pointing.

// Sets the local scale of the current GameObject
transform.localScale = new Vector3(direction, 1, 1);


(Try flipping the y value too!)

• You're right. Two others have already said. Why answer with the same thing again? Sep 23, 2014 at 7:27
• No one had any code samples, I figured it would be nice to have one. Sep 24, 2014 at 17:07

Per the Unity 4.3 - 2D Game Walkthrough at about 8:15, their implementation of the Flip() function to reverse the character sets the x scale to -1