Scene View Camera interfering with Renderer.isVisible

Right then, so I’m using a dual-monitor setup here, with all of Unity on the right monitor except for the Game tab, which takes up the whole left monitor. Now then, I have some scripts that use the Renderer.isVisible message. Unfortunately, the scene view’s camera interferes with it. Is there any way to get the Renderer.isVisible to ignore the Scene view’s camera? Or even better, how to get it to only pay attention to certain cameras?

I’m also interested in a solution for that. Affecting OnBecameVisible/OnBecameInvisible events.

I think it’s odd that they don’t give us a parameter that says “ok, it’s visible in A camera, but is it visible in THIS camera?”

Not really odd, cause isVisible does not care about the camera its visible to but if it has to be sent to the GPU for rendering :slight_smile:

Also with the editor camera, which renders every layer at any time, you are trying to apply “runtime logic” to editor time logic, which won’t work. The purpose of the editor camera is rendering the scene independent of layers, filters, shaders etc, the way the data really are. If you want to get rid of it at runtime, then ensure its on the same window as the game window so its hidden while the game is running (there is enough stuff that you want on the screen aside to it normally to allow that) or add the check below.

If you want to know if something is rendered by this camera, and thats assuming you don’t use occlusion culling, you would project its position to the cameras view space. if it is within the current Screen rect and in front of the cam its visible on this cam.

2 Likes

Clever…not really…i feel stupid for not thinking of that