seems simple, but I can’t find anything that returns me the terrain’s maximum height.
not in Unity - Scripting API: Terrain,
nor in Unity - Scripting API: TerrainData
I’m not talking about setting it in the editor,
I want to get the value in code (to use in calculations)
use the size variable of TerrainData : Unity - Scripting API: TerrainData.size
var terrainSize : Vector3 = terrain.terrainData.size;
Debug.Log( "terrainSize : " + terrainSize );
Debug.Log( "terrain Max Height : " + terrainSize.y );
TerrainData.GetHeights can give you all the heights in a 2d array of float values.
One you have that it should be easy to write a for loop that goes through that array and sets maxHeight to the current value if it’s larger than maxHeight now.
How about using Bounds:
_terrain = Terrain.activeTerrain;
float max_height = _terrain.terrainData.bounds.max.y;