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:
Or you can calculate whether an object's bounding box falls within the camera's view frustum, using these two functions:
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
answered Nov 19 '09 at 03:12 PM
The answer given by Duck is the most accurate. If you can do with something less accurate, you can consider just checking if the position of the object is seen by the camera.
To find out if a point in the scene is seen by a camera, you can use Camera.WorldToViewportPoint to get that point in viewport space.
If both the x and y coordinate of the returned point is between 0 and 1 (and the z coordinate is positive), then the point is seen by the camera.
answered Nov 19 '09 at 03:20 PM
If the object has a renderer attached, then this should work:
Create a new class cameraSight and array of this class named seenByCameraList
then initialize it in Start()
Assuming that camera count will not be changed dynamicaly, in Update() just clear flags to false;
If Unity whave to render this object, it will call OnWillRenderObject() , where we modify the flags for cameras, to which this object is visible
And the final function which you call for testing visibility to particular camera
To avoid clearing of flag, there is sawMe flag which copies a value of seesMe from previous frame. So information is one frame delayed.