TerrainData Manual     Reference     Scripting  
Scripting > Runtime Classes > TerrainData
TerrainData Inherits from Object

The TerrainData class stores heightmaps, detail mesh positions, tree instances, and terrain texture alpha maps.

The Terrain component links to the terrain data and renders it.

Variables
heightmapWidth

Width of the terrain in samples (Read Only).

heightmapHeight

Height of the terrain in samples (Read Only).

heightmapResolution

Resolution of the heightmap

heightmapScale

The size of each heightmap sample

size

The total size in world units of the terrain

wavingGrassStrength

Strength of the waving grass in the terrain.

wavingGrassAmount

Amount of waving grass in the terrain.

wavingGrassSpeed

Speed of the waving grass.

wavingGrassTint

Color of the waving grass that the terrain has.

detailWidth

Detail width of the TerrainData.

detailHeight

Detail height of the TerrainData.

detailResolution

Detail Resolution of the TerrainData.

detailPrototypes

Contains the detail texture/meshes that the terrain has.

treeInstances

Contains the current trees placed in the terrain.

treePrototypes

The list of tree prototypes this are the ones available in the inspector.

alphamapLayers

Number of alpha map layers

alphamapResolution

Resolution of the alpha map.

alphamapWidth

Width of the alpha map.

alphamapHeight

Height of the alpha map.

baseMapResolution

Resolution of the base map used for rendering far patches on the terrain

splatPrototypes

Splat texture used by the terrain.

Functions
GetHeight

Gets the height at a certain point x,y

GetInterpolatedHeight

Gets an interpolated height at a point x,y

GetHeights

Get an array of heightmap samples..

SetHeights

Set an array of heightmap samples.

GetSteepness

Gets a value on how steep is the terrain at point x,y

GetInterpolatedNormal

Get an interpolated normal at a given location.

SetDetailResolution

/detailResolution/ specifies the number of pixels in the detail resolution map. A larger detailResolution, leads to more accurate detail object painting.

RefreshPrototypes

Refreloads all the values of the available prototypes in the TerrainData Object.

GetSupportedLayers

Returns an array of all supported detail layer indices in the area.

GetDetailLayer

Returns a 2D array of the detail object density in the specific location.

SetDetailLayer

Sets the detail layer density map.

GetAlphamaps

Returns the alpha map at a position x, y given a width and height

SetAlphamaps

Assign all splat values in the given map area.

Inherited members
Inherited Variables
name

The name of the object.

hideFlags

Should the object be hidden, saved with the scene or modifiable by the user?

Inherited Functions
GetInstanceID

Returns the instance id of the object.

ToString

Returns the name of the game object.

Inherited Class Functions
operator bool

Does the object exist?

Instantiate

Clones the object original and returns the clone.

Instantiate.<T>

Destroy

Removes a gameobject, component or asset.

DestroyImmediate

Destroys the object obj immediately. It is strongly recommended to use Destroy instead.

FindObjectsOfType

Returns a list of all active loaded objects of Type type.

FindObjectOfType

Returns the first active loaded object of Type type.

operator ==

Compares if two objects refer to the same

operator !=

Compares if two objects refer to a different object

DontDestroyOnLoad

Makes the object target not be destroyed automatically when loading a new scene.