Get the dimensions of a terrain

Sorry if this question is so silly, but I really have looked hard for an answer and can't find one.

I am trying to make a particle system that has the same x width and z lenght of my terrain, and so what I thought to do was through code get those dimensions and then through code change my particle systems range in the x and z direction to match the terrain's dimensions.

So I set my landscape as a variable in the following way

function Start ()
{
    var go = GameObject.Find("landscape");
}

but can't find out how to access the dimensions. Is there a way? Also is my approach even a logical one, or is there an easier way. Thank you so much

Add below the var go line in your script:

var terrainSize : Vector3;
function Start ()
{
    var go = GameObject.Find("landscape");
    var terrain : Terrain = go.GetComponent(Terrain);
    terrainSize = terrain.terrainData.size;
}

That'll give you a vector3 in world units

Documented here: http://unity3d.com/support/documentation/ScriptReference/TerrainData-size.html http://unity3d.com/support/documentation/ScriptReference/TerrainData.html http://unity3d.com/support/documentation/ScriptReference/Terrain.html

The general way of finding the "size" of an object is to get the renderer.bounds