Avoid repeating same objects in object pooling

I would like to avoid same objects in object pooling in an infinite platform runner game.

Any help is much appreciated.

Please let me know if you need to see the code.

Well, a simple solution is to use a HashSet.

Lists allow you to add the same thing…as many times as you want.
HashSet only allows for unique items.

If you’re set on using Lists, you can do something like:

        if (MyList.Contains(gameObject))
        {
            //I'm already in the list. DO NOT ADD.
        }
        else
        {
            //I'm NOT in the list. Add me!
            MyList.Add(gameObject);
        }