Select your preferred scripting language. All code snippets will be displayed in this language.
class in UnityEngine
/
Inherits from:Object
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseThe 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.
alphamapHeight | Height of the alpha map. |
alphamapLayers | Number of alpha map layers. |
alphamapResolution | Resolution of the alpha map. |
alphamapTextures | Alpha map textures used by the Terrain. Used by Terrain Inspector for undo. |
alphamapWidth | Width of the alpha map. |
baseMapResolution | Resolution of the base map used for rendering far patches on the terrain. |
bounds | The local bounding box of the TerrainData object. |
detailHeight | Detail height of the TerrainData. |
detailPrototypes | Contains the detail texture/meshes that the terrain has. |
detailResolution | Detail Resolution of the TerrainData. |
detailWidth | Detail width of the TerrainData. |
heightmapHeight | Height of the terrain in samples (Read Only). |
heightmapResolution | Resolution of the heightmap. |
heightmapScale | The size of each heightmap sample. |
heightmapWidth | Width of the terrain in samples (Read Only). |
size | The total size in world units of the terrain. |
splatPrototypes | Splat texture used by the terrain. |
thickness | The thickness of the terrain used for collision detection. |
treeInstanceCount | Returns the number of tree instances. |
treeInstances | Contains the current trees placed in the terrain. |
treePrototypes | The list of tree prototypes this are the ones available in the inspector. |
wavingGrassAmount | Amount of waving grass in the terrain. |
wavingGrassSpeed | Speed of the waving grass. |
wavingGrassStrength | Strength of the waving grass in the terrain. |
wavingGrassTint | Color of the waving grass that the terrain has. |
GetAlphamaps | Returns the alpha map at a position x, y given a width and height. |
GetDetailLayer | Returns a 2D array of the detail object density in the specific location. |
GetHeight | Gets the height at a certain point x,y. |
GetHeights | Get an array of heightmap samples. |
GetInterpolatedHeight | Gets an interpolated height at a point x,y. |
GetInterpolatedNormal | Get an interpolated normal at a given location. |
GetSteepness | Gets the gradient of the terrain at point (x,y). |
GetSupportedLayers | Returns an array of all supported detail layer indices in the area. |
GetTreeInstance | Get the tree instance at the specified index. It is used as a faster version of treeInstances[index] as this function doesn't create the entire tree instances array. |
RefreshPrototypes | Reloads all the values of the available prototypes (ie, detail mesh assets) in the TerrainData Object. |
SetAlphamaps | Assign all splat values in the given map area. |
SetDetailLayer | Sets the detail layer density map. |
SetDetailResolution | Set the resolution of the detail map. |
SetHeights | Set an array of heightmap samples. |
SetHeightsDelayLOD | Set an array of heightmap samples. |
SetTreeInstance | Set the tree instance with new parameters at the specified index. However, TreeInstance.prototypeIndex and TreeInstance.position can not be changed otherwise an ArgumentException will be thrown. |
hideFlags | Should the object be hidden, saved with the scene or modifiable by the user? |
name | The name of the object. |
GetInstanceID | Returns the instance id of the object. |
ToString | Returns the name of the game object. |
Destroy | Removes a gameobject, component or asset. |
DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
DontDestroyOnLoad | Makes the object target not be destroyed automatically when loading a new scene. |
FindObjectOfType | Returns the first active loaded object of Type type. |
FindObjectsOfType | Returns a list of all active loaded objects of Type type. |
Instantiate | Clones the object original and returns the clone. |
bool | Does the object exist? |
operator != | Compares if two objects refer to a different object. |
operator == | Compares two object references to see if they refer to the same object. |