Quantcast
Channel: Answers for "Unity 5 (2D) - Sprite disappears when flipping via localScale"
Viewing all articles
Browse latest Browse all 19

Answer by John_Chantzis

$
0
0
My guess would be a problem with negative scale (or zero in other cases). I recommend using a **rotation** of 180° on the proper axis, probably the Y-Axis, but it depends on your project setup. transform.Rotate(0, 180, 0); In your case it would be: // Flip sprite / animation over the x-axis protected void Flip() { isFacingRight = !isFacingRight; if (isFacingRight) transform.Rotate(0, 180, 0); else transform.Rotate(0, 0, 0); } **Note:** You might wanna reverse the if/else statements depending on the way your sprite is facing initially.

Viewing all articles
Browse latest Browse all 19

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>