According to the docs renderer.isVisible becomes true if the objects renderer is visible by any camera. How do I make it only true if visible by a specific camera?
Answer by Grimmy
Oct 07, 2010 at 11:49 AM
Okay well it actually 'just works' as long as the cameras are set to render different layers.
Basically 'isVisible' already takes into account the object culling mask..which I didnt realise.
It's more than that. "Visibility" just means whether it gets sent to the GPU to be rendered. It may then be occluded by objects that are closer to the camera. http://forum.unity3d.com/threads/34225-Are-OnBecameVisible-and-OnBecameInvisible-named-poorly?p=222221
Yeah I see. I'll need to write something to make sure the object is also facing the camera and not hidden by other objects as well as'being rendered by the camera/sent to GPU' :)
Also be aware that this isVisible is true if the editor camera can see that object. This is a pain when you want to use this variable for game logic like an enemy not shooting at the player unless they are on screen.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
1 Person is following this question.
How to make camera position relative to a specific target.
Keep camera horizontal with RotateAround
A wired question: the scale increasing, camera shake disappearing
Orbit/Rotate camera through four set positions