Rendering objects that are visible

Hello i was wondering how would you make a script that renders the objects that are only visible to the camera.

If I understand your question correctly, what you are looking for is Occlusion Culling and is provided by Unity. Go to Window → Occlusion Culling