Terrain Inherits from MonoBehaviour

The Terrain component renders the terrain.

Variables
terrainData

The Terrain Data that stores heightmaps, terrain textures, detail meshes and trees.

treeDistance

The maximum distance at which trees are rendered

treeBillboardDistance

Distance from the camera where trees will be rendered as billboards only.

treeCrossFadeLength

Total distance delta that trees will use to transition from billboard orientation to mesh orientation.

treeMaximumFullLODCount

Maximum number of trees rendered at full LOD.

detailObjectDistance

Detail objects will be displayed up to this distance.

detailObjectDensity

Density of detail objects.

heightmapPixelError

An approximation of how many pixels the terrain will pop in the worst case when switching lod.

heightmapMaximumLOD

Lets you essentially lower the heightmap resolution used for rendering

basemapDistance

Heightmap patches beyond basemap distance will use a precomputed low res basemap.

lightmapIndex

The index of the lightmap applied to this renderer.

castShadows

Should terrain cast shadows?.

materialTemplate

editorRenderFlags

Functions
SampleHeight

Samples the height at the given position defined in world space, relative to the terrain space.

AddTreeInstance

Adds a tree instance to the terrain

SetNeighbors

Lets you setup the connection between neighboring Terrains.

GetPosition

Get the position of the terrain

Flush

Flushes any change done in the terrain so it takes effect.

Class Variables
activeTerrain

The active terrain. This is a convenience function to get to the main terrain in the scene.

Class Functions
CreateTerrainGameObject

Creates a Terrain including collider from TerrainData

Inherited members
Inherited Variables
useGUILayout

Disabling this lets you skip the GUI layout phase.

enabled

Enabled Behaviours are Updated, disabled Behaviours are not.

transform

The Transform attached to this GameObject (null if there is none attached).

rigidbody

The Rigidbody attached to this GameObject (null if there is none attached).

camera

The Camera attached to this GameObject (null if there is none attached).

light

The Light attached to this GameObject (null if there is none attached).

animation

The Animation attached to this GameObject (null if there is none attached).

constantForce

The ConstantForce attached to this GameObject (null if there is none attached).

renderer

The Renderer attached to this GameObject (null if there is none attached).

audio

The AudioSource attached to this GameObject (null if there is none attached).

guiText

The GUIText attached to this GameObject (null if there is none attached).

networkView

The NetworkView attached to this GameObject (Read Only). (null if there is none attached)

guiTexture

The GUITexture attached to this GameObject (Read Only). (null if there is none attached)

collider

The Collider attached to this GameObject (null if there is none attached).

hingeJoint

The HingeJoint attached to this GameObject (null if there is none attached).

particleEmitter

The ParticleEmitter attached to this GameObject (null if there is none attached).

particleSystem

The ParticleSystem attached to this GameObject (null if there is none attached).

gameObject

The game object this component is attached to. A component is always attached to a game object.

tag

The tag of this game object.

name

The name of the object.

hideFlags

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

Inherited Functions
Invoke

Invokes the method methodName in time seconds.

InvokeRepeating

Invokes the method methodName in time seconds.

CancelInvoke

Cancels all Invoke calls on this MonoBehaviour.

IsInvoking

Is any invoke on methodName pending?

StartCoroutine

Starts a coroutine.

StopCoroutine

Stops all coroutines named methodName running on this behaviour.

StopAllCoroutines

Stops all coroutines running on this behaviour.

GetComponent

Returns the component of Type type if the game object has one attached, null if it doesn't.

GetComponentInChildren

Returns the component of Type type in the GameObject or any of its children using depth first search.

GetComponentsInChildren

Returns all components of Type type in the GameObject or any of its children.

GetComponents

Returns all components of Type type in the GameObject.

CompareTag

Is this game object tagged tag?

SendMessageUpwards

Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour

SendMessage

Calls the method named methodName on every MonoBehaviour in this game object.

BroadcastMessage

Calls the method named methodName on every MonoBehaviour in this game object or any of its children.

GetInstanceID

Returns the instance id of the object.

ToString

Returns the name of the game object.

Inherited Messages Sent
Update

Update is called every frame, if the MonoBehaviour is enabled.

LateUpdate

LateUpdate is called every frame, if the Behaviour is enabled.

FixedUpdate

This function is called every fixed framerate frame, if the MonoBehaviour is enabled.

Awake

Awake is called when the script instance is being loaded.

Start

Start is called just before any of the Update methods is called the first time.

Reset

Reset to default values.

OnMouseEnter

OnMouseEnter is called when the mouse entered the GUIElement or Collider.

OnMouseOver

OnMouseOver is called every frame while the mouse is over the GUIElement or Collider.

OnMouseExit

OnMouseExit is called when the mouse is not any longer over the GUIElement or Collider.

OnMouseDown

OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider.

OnMouseUp

OnMouseUp is called when the user has released the mouse button.

OnMouseUpAsButton

OnMouseUpAsButton is only called when the mouse is released over the same GUIElement or Collider as it was pressed.

OnMouseDrag

OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse.

OnTriggerEnter

OnTriggerEnter is called when the Collider other enters the trigger.

OnTriggerExit

OnTriggerExit is called when the Collider other has stopped touching the trigger.

OnTriggerStay

OnTriggerStay is called once per frame for every Collider other that is touching the trigger.

OnCollisionEnter

OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.

OnCollisionExit

OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.

OnCollisionStay

OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.

OnControllerColliderHit

OnControllerColliderHit is called when the controller hits a collider while performing a Move.

OnJointBreak

Called when a joint attached to the same game object broke.

OnParticleCollision

OnParticleCollision is called when a particle hits a collider (legacy particle system only).

OnBecameVisible

OnBecameVisible is called when the renderer became visible by any camera.

OnBecameInvisible

OnBecameInvisible is called when the renderer is no longer visible by any camera.

OnLevelWasLoaded

This function is called after a new level was loaded.

OnEnable

This function is called when the object becomes enabled and active.

OnDisable

This function is called when the behaviour becomes disabled () or inactive.

OnDestroy

This function is called when the MonoBehaviour will be destroyed.

OnPreCull

OnPreCull is called before a camera culls the scene.

OnPreRender

OnPreRender is called before a camera starts rendering the scene.

OnPostRender

OnPostRender is called after a camera finished rendering the scene.

OnRenderObject

OnRenderObject is called after camera has rendered the scene.

OnWillRenderObject

OnWillRenderObject is called once for each camera if the object is visible.

OnGUI

OnGUI is called for rendering and handling GUI events.

OnRenderImage

OnRenderImage is called after all rendering is complete to render image

OnDrawGizmosSelected

Implement this OnDrawGizmosSelected if you want to draw gizmos only if the object is selected.

OnDrawGizmos

Implement this OnDrawGizmos if you want to draw gizmos that are also pickable and always drawn.

OnApplicationPause

Sent to all game objects when the player pauses.

OnApplicationFocus

Sent to all game objects when the player gets or looses focus.

OnApplicationQuit

Sent to all game objects before the application is quit.

OnPlayerConnected

Called on the server whenever a new player has successfully connected.

OnServerInitialized

Called on the server whenever a Network.InitializeServer was invoked and has completed.

OnConnectedToServer

Called on the client when you have successfully connected to a server

OnPlayerDisconnected

Called on the server whenever a player disconnected from the server.

OnDisconnectedFromServer

Called on the client when the connection was lost or you disconnected from the server.

OnFailedToConnect

Called on the client when a connection attempt fails for some reason.

OnFailedToConnectToMasterServer

Called on clients or servers when there is a problem connecting to the MasterServer.

OnMasterServerEvent

Called on clients or servers when reporting events from the MasterServer.

OnNetworkInstantiate

Called on objects which have been network instantiated with Network.Instantiate

OnSerializeNetworkView

Used to customize synchronization of variables in a script watched by a network view.

OnAudioFilterRead

If OnAudioFilterRead is implemented, Unity will insert a custom filter into the audio DSP chain.

OnAnimatorMove

Callback for processing animation movements for modifying root motion.

OnAnimatorIK

Callback for setting up animation IK (inverse kinematics)

Inherited Class Functions
print

Logs message to the Unity Console. This function is identical to Debug.Log.

operator bool

Does the object exist?

Instantiate

Clones the object original and returns the clone.

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.