Delete last 5 Clones so only 5 exist

Im making a game where you fly through rings and collect the rings and right after another clone of the ring spawns in a random area. I have that all working and good, but i could just make it so that the clones are just spawning over and over but if someone did really really good they could really lag out the phone with lots and lots of clones. So i want to make it so that you collect 5 rings, and then the last ring gets destroyed, so that there are still 5 clones but 5 at most or something. I was going to have a script on every clone that adds one to every clone and if a integar gets to be over 5 it would get deleted, but i wasn’t able to get it to work. So how do you delete the clone so there is only 5?

Sounds like you could just keep a Generic List of the gameObjects. When you create a new ring, you add it (it will get added to the end of the list), and in Update you check if there are more than 5 rings in the list; If yes, then you destroy enough rings so the Count is 5 again, starting from the 0 index of the list, then +1, and so on. The list will then have only the five most recently added rings in it.

The simplest way to do this would be to have a collection with a capacity of five. Add GameObjects to the collection as they are created. When the collection is at capacity then instead of adding a new one move the oldest element.

Essentially what you want is a modified object pool. Google object pool for some good solutions.