2d sprite on x flip is grayed out

I have a script where my player, a 2d square, flips when walking left. When it does it becomes grayed out.
7379984--900338--upload_2021-8-1_13-57-55.png7379984--900341--upload_2021-8-1_13-58-9.png

 if (facingRight == false && moveInput > 0)
        {
            Flip();
        }
        else if (facingRight == true && moveInput < 0)
        {
            Flip();
        }

    }

    void Flip()
    {
        facingRight = !facingRight;
        Vector3 localScale = transform.localScale;
        localScale.x *= -1f;
        transform.localScale = localScale;
    }

hmm are you sure your player is visible on both sides?
by giving it a negative scale you are now looking at its backside, instead of the frontside

Sprites (as in SpriteRenderer) with the default material are usually drawn on both, back and front side by default…
this is not the case for all materials

so… if you use a not-double-sided material (like the standard material (not double sided) instead of the sprite default material (double sided)), your object will just appear invisible after you negate the scale, since you are now looking at the invisible backside

this is also true for 3D Planes if you use these instead of 2D SpriteRenderer, in either case, if you negate the scale you want a double sided material

1 Like

Thanks for pointing in the right direction. My material was standard and not sprite/default. So now it stays visible facing both sides. Now, it hides the 2 square sprites for the eyes. As I was typing this, I tried the sorting layer setting. That fixed it real good. Have a swell Sunday.