If I call flipx on the spriterenderer of an image, why doesn't the sprite attached to the image flip?

I have a strange issue related to the flipX varialble of a sprite renderer.

Consider the following code:

        leftImageSpriteRenderer = leftImage.GetComponent<SpriteRenderer>();
        if (leftImageSpriteRenderer != null)
        {
            Debug.Log("Found the sprite renderer");
            leftImageSpriteRenderer.flipX = true;
        }
        leftImage.sprite = AssetDatabase.LoadAssetAtPath<Sprite>("Assets/Portraits/character_portrait.png");

My expectation would be that the character portrait would be flipped along the X axis. However, while the sprite appears, it is not flipped. IS the problem that I’m flipping the spriterender component and referring the sprite in the parent image object?

Thanks for your attention!

@robert-sherwood

Its because to affect things like colliders and the actual sprite you have to use the negative of your current scale.

SpriteRenderer.flipX:

public bool flipX;

Description
Flips the sprite on the X axis.

Only the rendering is affected. Use negative Transform.scale, if you want to affect all the other components (for example colliders).