public void UpdateMeshComponent() { Mesh thisChunkGOMesh = GetComponent <MeshFilter>().sharedMesh = loadedChunk.m_meshData.BuildMeshComponent(); Mesh surfaceGOMesh = surfaceGO.GetComponent <MeshFilter>().sharedMesh = loadedChunk.m_surfaceMeshData.BuildMeshComponent(); //Setting Colliders GetComponent <MeshCollider>().sharedMesh = thisChunkGOMesh; surfaceGO.GetComponent <MeshCollider>().sharedMesh = surfaceGOMesh; //Setting Uvs UVMapper.BoxUV(surfaceGOMesh, surfaceGO.transform); UVMapper.BoxUV(thisChunkGOMesh, transform); }
// Update is called once per frame void Update() { if (sourceMesh == null) { return; } // Use a copy of the mesh! Mesh tempMesh = Instantiate(sourceMesh); UVMapper.BoxUV(tempMesh, transform); GetComponent <MeshFilter>().sharedMesh = tempMesh; }