Big FPS drop when using SetHeights on terrain

I’m using GetHeights and SetHeights to alter the terrain at run time. I only change 1 height at once, but i’m still getting a massive stutter when I use SetHeights.

I don’t have any trees or grass on the terrain, it’s purely terrain at this point.

My terrain is fairly large, so I assume it’s because it’s recalculating the collision mesh?

Is there any way of reducing the stutter or is this simply something I have to live with?

Go into Set Resolution which is under terrain and lower the the terrain width and length. This will cause the terrain to be smaller. This should help this problem. Or you could just make the graphic quality less so it will run faster.

The Unity docs say “The area affected is defined by the array dimensions and starts at xBase and yBase. The heights array is indexed as [y,x].” This means you can directly address the nodes you are altering without accessing any others. Simply use the first 2 values in the setHeights function as the starting point for the area you want to alter, and then the size of the array defines the ending point. I saved 40 FPS when I changed my code to this.