How to add camera and movement borders

I am making a simple side 2d scroller game, where the camera follows the player only in the x axis (so if he jumps, the camera will not move). I am trying to make it so that the camera can follow the player, but at a certain moment stop following him (lets say the end of the map, but in such a way that is is not visible that the map is over). The player from there can keep moving, even though he is not in the center of the camera anymore, until he reaches that border, which is not in the very left in screen. Then the player can go back, and the camera will only start following him again, when he gets back to the center.

Thanks in advance. I know it sounds confusing so ask me any questions you might have.

Did you try the Standard Assets?

There are scripts for controlling the character and for the camera.
Try the scripts PlatformerCharacter2D and CameraFollow. These should help you do what you want.

You can find these under Assets>Import Package>2D