Quantcast
Channel: Questions in topic: "crash"
Viewing all articles
Browse latest Browse all 2383

Unity crashing and LocalScale not working

$
0
0
Hi, so I'm trying to get the my enemy and player sprites to flip whenever they face the other direction. Right now, I have it just use the negative of whatever the player or enemies change direction. The only thing is, it isn't working and it is crashing unity anytime I play. I you could help me out, I'd greatly appreciate it! public bool FacingRight = true; public float Righty = 1f; public float Lefty = 1f; void Update () { if (transform.rotation.eulerAngles.z > 90 && transform.rotation.eulerAngles.z < 270 && FacingRight == true) { FacingRight = false; transform.localScale += new Vector3 (transform.localScale.x, transform.localScale.y, transform.localScale.z); } if (transform.rotation.eulerAngles.z < 90 || transform.rotation.eulerAngles.z > 270 && FacingRight == false) { FacingRight = true; transform.localScale += new Vector3 (transform.localScale.x, transform.localScale.y, transform.localScale.z); } }

Viewing all articles
Browse latest Browse all 2383

Trending Articles



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