diff --git a/Assets/Soundings/Runtime/PassageWake.cs b/Assets/Soundings/Runtime/PassageWake.cs index a483c8e..154df90 100644 --- a/Assets/Soundings/Runtime/PassageWake.cs +++ b/Assets/Soundings/Runtime/PassageWake.cs @@ -113,8 +113,11 @@ namespace Soundings return; } - mesh.SetVertices(positions, 0, row * Columns); - mesh.SetUVs(0, profiles, 0, row * Columns); + int vertexCount = row * Columns; + if (mesh.vertexCount != vertexCount) + mesh.Clear(); + mesh.SetVertices(positions, 0, vertexCount); + mesh.SetUVs(0, profiles, 0, vertexCount); mesh.SetIndices(triangles, 0, (row - 1) * (Columns - 1) * 6, MeshTopology.Triangles, 0, true); Bounds bounds = mesh.bounds; bounds.Expand(new Vector3(0, 4, 0));