in 2D, I’m using a script to flip the sprite horizontally to show the player he is facing the other direction and not moonwalking, however this recently stopped working and I have no idea why. Are there any variables that would prevent a script which inverts the scale of an object from working? This is a snippet of the script I am using (your typical flip script)
if (h < 0 && facingRight)
{
FlipX();
print("Flip Left!");
}
if (h > 0 && !facingRight)
{
FlipX();
print("Flip Right!");
}
function FlipX(){
facingRight = !facingRight;
transform.localScale = new Vector2(transform.localScale.x * -1, transform.localScale.y);
}