How to make camera boundary or lock

Hi everyone. I am working on small 2D project game with launching like angry birds. I want to know how to make that enemy or main character dont go out of camera vision. I am not sure if I explained well. Please help or reffer me to similar topic. Thanks alot.

You can try with an add-on : cinemachine 2D : See here

hope it can help

There are different ways to approach this.
You could get the camera view-rectangle with a script and make sure that your character can not walk out of these defined borders.

Another, more intuitive solution would be to use colliders. The YouTube channel Code Monkey actually has a very nice tutorial for that. This should give you all the tools that you need to get the desired result: Character Controller in Unity 2D! (Move, Dodge, Dash) - YouTube