How to tell if an object that behind another object can be seen?

Hello,
I am trying to find out how to check if an object that behind another object can be seen by camera. I figured out a way of doing it but it requires 32400 rays to be shoot out from the camera per frame which i think that is a lot of process to do. So what would be the easiest way to achieve this? What i’ve been thinking about for now is checking which object is behind another and then comparing the bounds of colliders of these two object and see if front object has a bigger collider so the object behind cannot be seen by the camera BUT this won’t work if it is a complex geometry…Any ideas?
Thank you in advance!

Hi,

You can use the built-in function which is renderer.isVisible : Unity - Scripting API: Renderer.isVisible