Flip a 2D sprite in Unity

Daniel Kirwan
Sep 21, 2021

--

Objective: Flip your 2D sprite when the player changes direction

Flipping the player or enemy sprites is an easy thing to do in Unity. On the game object that has the sprite renderer and there is an option to flip the sprite on the X and Y axis.

Clicking the X option will immediately change direction. This is also an easy thing to do in code.

First get a reference to the sprite renderer component in the relevant script. Then to flip the sprite you change the flipX bool to true or false, depending on your direction. If you want to face right then leave it false, if you want to face left then change it to true.

And that is it for flipping the sprite.

--

--