To do this you need to create a bounding box which you can get the bounds from. Then restrict your camera transform using mathf.clamp and keep it within the bounds of the bounding box.