I have a 2d game I am using sprites on (so using sprite renderer, not sure if that is my problem) that is very similar to flappy birds. I have an empty GameObject that has a script attached to it that spawns prefabs of an object that has been dropped into the script (one empty GameObject has has attached the one that spawns ground sections, another the copies of the obstacle). My problem is that I cannot get OnBecameInvisible to run while the program is going and I cannot figure out why and was hoping for some suggestions. Below is what I am trying to run, and I have tried variations of it, but no dice.
void OnBecameInvisible(){
Destroy (gameObject);
}