My camera changes direction when my player changes direction

Hello !
It’s a bit of a twisted question, but I think it’s easy to solve:

I have my player on a 2D scene that when he moves to the left, changes the size of x to negative so that the player turns to the left. But the problem is that the camera that is attached to my flip player too, which is very ugly since there is no transition

1 -

2- (When I go left)

I would like to point out that the problem does not have the blue I have but that the camera also rotates when I would like it to remain to follow the character in the other direction

Anyone have a solution?
Thank you.

look for some camera follow scripts, so you dont need to keep camera as a child of your player:
http://answers.unity.com/answers/331086/view.html

or can use cinemachine camera systems:

Thank you very much the code works perfectly!!!