There's a whole slew of ways to achieve this, depending on the precise functionality you need.
You can get events when an object is visible within a certain camera, and when it enters or leaves, using these functions:
OnWillRenderObject, Renderer.isVisible, Renderer.OnBecameVisible, and OnBecameInvisible
Or you can calculate whether an object's bounding box falls within the camera's view frustum, using these two functions:
GeometryUtility.CalculateFrustumPlanes GeometryUtility.TestPlanesAABB
If you've already determined that the object is within the camera's view frustum, you could cast a ray from the camera to the object in question, to see whether there are any objects blocking its view. Physics.Raycast
Is it just me, or does the example for http://unity3d.com/support/documentation/ScriptReference/GeometryUtility.TestPlanesAABB.html only work for a static camera? It gets the frustum planes in the Start() method, so if the camera moves it will be inaccurate. Am I correct in thinking that?
– Gillissie@Gillissie (several years late): I got this to work just by moving that line into the Update method.
– indolenceNote: The "GeometryUtility.TestPlanesAABB" seems to return true even if just a "portion" of the GO is visible. I would not use this if you want to ensure the entire GO is visible.
– BrianLedsworthGSNRenderer.isVisible does not exist
– MagicStylethere is a problem with OnWillRenderObject, Renderer.isVisible, Renderer.OnBecameVisible, and OnBecameInvisible , it consider rendering even if object is just enable in scene.
– DropoutGamer