Example #1
0
        private void Awake()
        {
            Mesh realMesh =
                GetComponent <MeshFilter>().sharedMesh;

            if (!simpleMeshDict.ContainsKey(realMesh.name))
            {
                welder.SetMesh(realMesh);
                int[]     weldedTriangles;
                Vector3[] weldedVertices;
                welder.WeldAndGet(out weldedVertices, out weldedTriangles);
                var meshData = new SimpleMesh
                {
                    Vertices  = weldedVertices,
                    Triangles = weldedTriangles,
                    MeshName  = realMesh.name
                };

                simpleMeshDict.Add(realMesh.name, meshData);
            }

            MeshData = simpleMeshDict[realMesh.name];
        }