Terrain's SetHeights method misbehaving

Hello, I am trying to raise terrain height in controlled, consistent increments of 1 Unity unit.

Every time I attempt to raise my terrain by 1 unit, however, SetHeights instead raises it by 1 unit and some fraction of a unit.

My terrain height is set to 500.
I use GetHeights to retrieve the height value of a coordinate and store it in float[0,0] height.

To height I add 0.002f to the value, and then call SetHeights(coordinates, height).

Every time I call GetHeights, I log the float value retrieved, and every time I set the heights, I log the value of the float set.


It seems SetHeight is trying to set the proper float value, but upon getting the heightwe notice that some extra is put in there. What the log should be showing is increments of 0.002, 0.004, 0.006, etc…

Does anybody know why SetHeight is being inaccurate?

Heights are actually 16-bit unsigned integers internally, where 1.0 = 65535. Therefore not all float values can be represented as heights, and they are rounded off to the nearest 1/65535.