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!
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.
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!)