Gameobject is in view of camera, but not visible

Is there a function that allows me to check if a gameobject is in the camera viewport, but the gameobject’s mesh renderer isn’t on.

Here’s what I’m trying to do. It’s a top down 2d game, and I’m trying to only render what the camera sees and turns off the render of gameobjects that aren’t in the camera’s viewport. (Kind of like a fake occlusion culling(Right?), but I ain’t got pro.).

Here’s the script.

if(gameObject.renderer.isVisible){
				renderer.enabled = true;
			}
			if(!gameObject.renderer.isVisible){
				renderer.enabled = false;
			}

gameobject.renderer.isVisible won’t work in this situation, correct? As it needs a renderer to be there, but when it isn’t visible it turns off the renderer and then once you go back, it won’t enable the renderer anymore.

Is there a function to replace isVisible? Or Perhaps there’s another way to do this?

Thanks!

This is called frustum culling and unity free already does it for you.

If you have to do it manually, use the renderers bounding box and test if they are in the view frustum using the tools in GeometryUtility Unity - Scripting API: GeometryUtility