Help with making item invisible if not on screen

Ok so you read the title, this is my code so far:

function OnBecameInvisible() {
    renderer.enabled = false;
}

So I tried OnBecameVisible but that doesn’t work if the object is invisible or renderer is disabled. I thought a Raycast might work but was wondering if there was another better way to do it. Thanks!

Read the section about clip planes. Sounds like you’re trying to do something called Frustum culling, which in most cases happens automatically.