How can I update the camera when the character flips?

I am creating a game in 2D where my character walks to the right and when he hits a spring he flips and walks to the left. That works but the camera stays at the same position. I need to have more space while looking at the respective direction. When I look left, I can’t see much what will come on the left side. I hope that is understandable :smiley: However, here are my camera script and the script how I flip the character:
public class Camera : MonoBehaviour
{
public Transform target;
private Vector3 offset;

void Start()
{
    offset = transform.position - target.position;
}

void Update()
{
    transform.position = target.position + offset;
}
}

Now the flip section:

private void Flip()
{
    facingRight = !facingRight;
    playerRb.transform.localScale = new Vector3(playerRb.transform.localScale.x *-1, playerRb.transform.localScale.y, playerRb.transform.localScale.z);
}

I hope you can help me out :slight_smile:

Kind regards

Perhaps you can try having a Camera Target point always set in front of the character, and as a child of the character. This will be what the camera aims at.

When your character inverses the X scale, it can inverse the camera target as well if it is a child object. If this works for your game, you might want to put a smoother on the camera so that it doesn’t switch instantly.