public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            Vector3ToHash other = (Vector3ToHash)obj;

            return(other.m_v == m_v);
        }
        public static Mesh RemoveDoubles(Mesh mesh)
        {
            int[]     trisArray     = mesh.triangles;
            Vector3[] vertexArray   = mesh.vertices;
            Vector2[] uvArray       = mesh.uv;
            Vector2[] uv2Array      = mesh.uv2;
            Vector2[] uv3Array      = mesh.uv3;
            Vector2[] uv4Array      = mesh.uv4;
            Vector3[] normalsArray  = mesh.normals;
            Vector4[] tangentsArray = mesh.tangents;
            Color[]   colorsArray   = mesh.colors;
            bool      hasUV         = mesh.uv.Length > 0;
            bool      hasUV2        = mesh.uv2.Length > 0;
            bool      hasUV3        = mesh.uv3.Length > 0;
            bool      hasUV4        = mesh.uv4.Length > 0;
            bool      hasNormals    = mesh.normals.Length > 0;
            bool      hasTangents   = mesh.tangents.Length > 0;
            bool      hasColors     = mesh.colors.Length > 0;

            List <int>     tris     = new List <int>();
            List <Vector3> vertices = new List <Vector3>();
            List <Vector2> uv       = new List <Vector2>();
            List <Vector2> uv2      = new List <Vector2>();
            List <Vector2> uv3      = new List <Vector2>();
            List <Vector2> uv4      = new List <Vector2>();
            List <Vector3> normals  = new List <Vector3>();
            List <Vector4> tangents = new List <Vector4>();
            List <Color>   colors   = new List <Color>();

            Dictionary <Vector3ToHash, int> m_vertexToIndex = new Dictionary <Vector3ToHash, int>();

            int newIndex = 0;

            for (int i = 0; i < trisArray.Length; ++i)
            {
                int           index   = trisArray[i];
                Vector3       vertex  = vertexArray[index];
                Vector3ToHash vToHash = new Vector3ToHash(vertex);
                if (!m_vertexToIndex.ContainsKey(vToHash))
                {
                    vertices.Add(vertex);
                    m_vertexToIndex.Add(vToHash, newIndex);

                    if (hasUV)
                    {
                        uv.Add(uvArray[index]);
                    }
                    if (hasUV2)
                    {
                        uv2.Add(uv2Array[index]);
                    }
                    if (hasUV3)
                    {
                        uv3.Add(uv3Array[index]);
                    }
                    if (hasUV4)
                    {
                        uv4.Add(uv4Array[index]);
                    }
                    if (hasNormals)
                    {
                        normals.Add(normalsArray[index]);
                    }
                    if (hasTangents)
                    {
                        tangents.Add(tangentsArray[index]);
                    }
                    if (hasColors)
                    {
                        colors.Add(colorsArray[index]);
                    }

                    tris.Add(newIndex);
                    newIndex++;
                }
                else
                {
                    int existingIndex = m_vertexToIndex[vToHash];
                    tris.Add(existingIndex);
                }
            }

            Mesh result = new Mesh();

            result.indexFormat = IndexFormat.UInt32;
            result.vertices    = vertices.ToArray();
            result.triangles   = tris.ToArray();
            result.uv          = uv.ToArray();
            result.uv2         = uv2.ToArray();
            result.uv3         = uv3.ToArray();
            result.uv4         = uv4.ToArray();
            result.normals     = normals.ToArray();
            result.tangents    = tangents.ToArray();
            result.colors      = colors.ToArray();

            return(result);
        }