I have a 2D Unity project, with a character sprite, and the Camera as its child so it follows the player. The Camera stops when it reaches the boundaries of the Scene, but so does the player.
I understand that they both stop because the Camera is the Character’s child.
The only code I’ve written is the player Input to make the character move.
I’d like to make the player be able to continue in whatever direction the Camera has stopped. Kind of like how the boundaries work in Stardew Valley. What’s the most straightforward way of doing it?
Thank you in advance! 
Steps to success:
- control the character only when moving (as you say you are above)
- set up the camera to follow the character, either with your own follow, by parenting, or with Cinemachine.
Camera stuff is pretty tricky… I hear all the Kool Kids are using Cinemachine from the Unity Package Manager.
There’s even a dedicated Camera / Cinemachine area: see left panel.
If you insist on making your own camera controller, do not fiddle with camera rotation.
The simplest way to do it is to think in terms of two Vector3 points in space:
- where the camera is LOCATED
- what the camera is LOOKING at
private Vector3 WhereMyCameraIsLocated;
private Vector3 WhatMyCameraIsLookingAt;
void LateUpdate()
{
cam.transform.position = WhereMyCameraIsLocated;
cam.transform.LookAt( WhatMyCameraIsLookingAt);
}
Then you just need to update the above two points based on your GameObjects, no need to fiddle with rotations. As long as you move those positions smoothly, the camera will be nice and smooth as well, both positionally and rotationally.
If you think your current camera should work and isn’t, that just sounds like you wrote a bug… and that means… time to start debugging!
By debugging you can find out exactly what your program is doing so you can fix it.
Use the above techniques to get the information you need in order to reason about what the problem is.
You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.
Once you understand what the problem is, you may begin to reason about a solution to the problem.
Remember with Unity the code is only a tiny fraction of the problem space. Everything asset- and scene- wise must also be set up correctly to match the associated code and its assumptions.
The camera is following the player. It sounds like you’re doing the opposite instead.
Be sure to use Cinemachine and stop worrying about these things. You can frame a cinemachine camera to borders and it will stop camera movement near borders while the character can move closer to the screen edge (the actual borders) and - if there’s no player collision there - the player could even leave the visible area. This is sometimes used when changing an area in a 2d game, can’t recall if stardew does it but nevertheless, you have it at your disposal.
Long story short: if you need to move the camera, use Cinemachine.
Thank you both for your answers 
I ended up adding a Cinemachine Camera (with Cinemachine Follow and Cinemachine Confiner 2D) to the Hierarchy and a Cinemachine Brain to the Main Camera. I made an invisible rectangle with Polygon Collider 2D for the scene’s boundaries, and added it to the Cinemachine Camera’s Tracking Target.
@CodeSmile , thank you, it does exactly what I needed 