OnBecameInvisible not working

So I’m trying to create a script where if the GameObject leaves the view of the camera but still exists (because objects will be destroyed, but that isnt meant to trigger this), for now it will debug log “Invisible”. However, whether I destroy it or not, it still debugs that.
Heres the script-

#pragma strict

function Start () {

}

function Update () {

}

function OnBecameInvisible () {
if (gameObject != null){
Debug.Log ("Invisible");
}
}

Thanks

Maybe its too late but you have to make sure a Renderer component is attached to the gameObject that this script is attached to

Destroying an object also trigger OnBecameInvisible