Unity 2D Camera Player Boundary

I need help with creating a script that is universal for all mobile devices, Android, iPhone, iPad etc… With all devices screen sizes change therefore the area of play changes. I need a new script to add to my player or camera that will not let the player leave or escape my screen for all screen resolutions. How would I do this? Right now my camera does not move and it will not move, the player only moves in the y direction up/down but it can escape my screen which is not good for any game. Thanks in advance for the help.

Use Unity - Scripting API: Camera.orthographicSize to get height of boundaries. Camera.orthographic - is half of screen height in world units. And use Unity - Scripting API: Camera.aspect to calculate width.
More details you can find here
how to get the width and height of a Orthographic camera. - Questions & Answers - Unity Discussions
Hope it helps you )