using UnityEngine;
using System.Collections.Generic;

public static class ArrayExtensions 
{
    public static T[] DeepCopy<T>(this T[] array) where T : ISupportsDeepCopy<T>
    {
        var result = new T[array.Length];

        for (int i = 0; i < array.Length; i++)
        {
            var item = array[i];
            if (item != null)
            {
                result[i] = array[i].DeepCopy();
            }
        }

        return result;
    }
}
