Sprite Renderer - Flip vs. localScale

Hi there!

I have been tinkering around with my own game some time ago and instead of manipulating the player object’s scale, I used the Sprite Renderer’s Flip property to flip the player’s sprite during running as it seemed to be the more natural choice. Is there any advantage of using one over the other?

PS: Love the course so far!

Hi Sorokan,

Welcome to our community! :slight_smile:

Flipping the sprite is perfectly fine if you have a symmetrical collider because the collider will not flip. The children won’t flip either. If your player had a sword which is not part of the sprite, flipping the “body” would not flip the sword and its collider.

As you can see, “flipping the sprite vs manipulating the scale” depends on the case. If you are in doubt, always test an approach (or multiple approaches). An approach that solves your problem is a solution by definition.

Did this help?


See also:

3 Likes

Hi Nina,

I didn’t think of child objects and colliders at all, since my player was symmetrical. I can clearly see the advantage of manipulating the scale in this scenario.

Thank you very much for your helpful answer. :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms