Flipping Char on Xaxis

Basically I am trying to flip the char on the x axis when it goes left but it turns blank.
I was doing something like this but when i go right i see the sprite, when i go left sprite disappears. What could I be doing wrong, Is there something in settings I need to check off?
if (horizontalInput > 0)
{
transform.localScale = new Vector3(1, 1, 1); // Facing right
}
else if (horizontalInput < 0)
{
transform.localScale = new Vector3(-1, 1, 1); // Facing left

You usually don’t scale the Sprites oppositely use the flip x,y inside 2d mesh render

its under sprite renderer right? I did something like this. In the inspector it i see it checked when it goes left and unchecked when it goes right. It still is causing the issues. It moes left and i see the sprite outline faving the other way but the actual sprite disappeared then reappears going right.
if (playerMovement.horizontalMove > 0)
{
// Moving right, ensure sprite is not flipped
spriteRenderer.flipX = false;
}
else if (playerMovement.horizontalMove < 0)
{
// Moving left, flip the sprite
spriteRenderer.flipX = true;
}

1 Like