Unity Terrain - Maximum Height?

In the editor on the options tab for terrain there is Terrain Height?
How can I get this by code?

I can only see a terrain height for the “paint height” brush tool… that’s not something that is stored in the terrain output.

If you want to access the terrain data you use

facepalm, indeed on the options tab on the top right in the editor you can see the exposed terrain settings.
The setting I want is not in terrainData and I would like to know how to access terrain Height

TerrainData.heightMapHeight should be the overall height. The normalised heights are access by TerrainData.GetHeights(…)

Yep. More specifically:

var terrain = GetComponent<Terrain>();
int nx = terrain.terrainData.heightmapWidth;
int ny = terrain.terrainData.heightmapHeight;

float[,] htmap = terrain.terrainData.GetHeights(0, 0, nx, ny);
float scale = terrain.terrainData.heightmapScale.y;

for (int i = 0; i < nx; i++)
    for (int j = 0; j < ny; j++)
        htmap[i, j] *= scale;

If you are changing the terrain heights don’t forget to renormalize your height data to between 0 and 1.

terrainData.size.y gives that height value