Keeping character in bounds of camera

Hi All

I am designing a 2d game which has a scrolling scene , my character and camera move along the scene from left to right at a constant speed. I am using the joystick script to move the character up/down/left/right but i can move the character off the screen and I want to keep it in the camera view. I am wanting to know the best way to stop the character moving off the screen whilst allowing the character to continue moving along the scene.

Cheers

You could un-project the character and check if their position is off-screen. If it is you can move the camera accordingly to keep them on-screen. That’s how I do it in XNA for the 360 at least.