OnWillRenderObject

I’m trying to make that when i see object it does something. Currently its doing it when
im facing the direction the object is in.

function OnWillRenderObject() {

       if(renderer.isVisible){
            
            Debug.Log("Hit");
     
          }
}

It does the script even when im looking it through a wall…

OnWillRenderObject() will be called if the Scene Editor window camera is rendering the object, not just your main camera. i.e. if you’re in the editor and are looking at the scene through the “Scene” window.