Copying GameObjects with reference types

I have a MonoBehaviour, which contains nested lists of references to classes. My serialization works fine, but when i copy my GameObject the references in those lists now points to same objects. I would like to create deep copies of those objects.

I could do this manually by using editor scripts, but i would like to have it working when manually copying gameobject inside Unity.

How does Unity duplicate lists? Can i somehow take part in this process?

Assuming the items in the list are clone-able you could create an extension like:

You can use an extension method.

static class Extensions
{
    public static IList<T> Clone<T>(this IList<T> listToClone) where T: ICloneable
    {
        return listToClone.Select(item => (T)item.Clone()).ToList();
    }
}

Answer from here