public MapGenerator mapGenerator; //drag a reference to our map generator private void OnTriggerExit2D(Collider2D other) { if (other.tag == "BG") { //Generate a new one mapGenerator.AddNewSection(); //remove from the list storing active map sections mapGenerator.CurrentSections.Remove(other.gameObject); //then destroy it Destroy(other.gameObject); } }