/* Apply Changes to mesh */ public void Apply() { m_mesh.SetVertices(m_vertices); HexObjectPool <Vector3> .Relese(m_vertices); m_mesh.SetTriangles(m_triangles, 0); HexObjectPool <int> .Relese(m_triangles); m_mesh.SetUVs(0, m_uv); HexObjectPool <Vector2> .Relese(m_uv); m_mesh.SetColors(m_colors); HexObjectPool <Color> .Relese(m_colors); if (useTerrainTypes) { m_mesh.SetUVs(2, m_terrainTypes); HexObjectPool <Vector3> .Relese(m_terrainTypes); } m_mesh.RecalculateNormals(); m_mesh.RecalculateBounds(); m_mesh.RecalculateTangents(); //m_mesh.UploadMeshData(); if (useCollider) { m_meshCollider.sharedMesh = m_mesh; } }
/* Clear Mesh */ public void Clear() { m_mesh.Clear(); m_vertices = HexObjectPool <Vector3> .Get(); m_triangles = HexObjectPool <int> .Get(); m_colors = HexObjectPool <Color> .Get(); m_uv = HexObjectPool <Vector2> .Get(); if (useTerrainTypes) { m_terrainTypes = HexObjectPool <Vector3> .Get(); } }