public static object DeepCopy(object src)
        {
            List <string>             classes = new List <string>();
            List <UnityEngine.Object> objects = new List <UnityEngine.Object>();
            List <float>  floats         = new List <float>();
            List <object> saveReferences = new List <object>();
            List <object> loadReferences = new List <object>();

            int num = CustomSerialization.WriteClass(src, classes, objects, floats, saveReferences);

            return(CustomSerialization.ReadClass(num, classes, objects, floats, loadReferences));
        }
        public void OnBeforeSerialize()
        {
            //System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch(); timer.Start();

            serializedVersion = MapMagic.version;

            List <string>             classesList = new List <string>();
            List <UnityEngine.Object> objectsList = new List <UnityEngine.Object>();
            List <float> floatsList = new List <float>();

            references.Clear();

            CustomSerialization.WriteClass(list, classesList, objectsList, floatsList, references);

            classes = classesList.ToArray();
            objects = objectsList.ToArray();
            floats  = floatsList.ToArray();

            //serializer.Clear();
            //listNum = serializer.Store(list);

            //timer.Stop(); Debug.Log("Serialize Time: " + timer.ElapsedMilliseconds + "ms");
        }