I was wondering if anyone knew a way to scale Mass placed trees in the Terrain functions. I am able to scale the trees when I place them manually on the terrain however when mass placing them they only appear as the default size.
Manually placing them would be an option if I could increase the brush size much higher than the maximum setting.
I have tried scaling up the tree prefab but it appears to ignore the scale settings.
any help would be highly appreciated
Here is a script that will randomly scale between two values the trees that are painted on the terrain.
#To set this up :#
Attach the script to the terrain object.
Drag and drop your terrain into the the Inspector.
Set the min and max scale to your liking.
#How to use this :#
Right-click on the script component in the Inspector, then a drop-down selection box appears. Example :
Click on Scale Existing Trees, now your trees have been scaled =]
Remove the script from the terrain when you are done.
public var terrain : Terrain;
public var minScale : float = 0.8;
public var maxScale : float = 1.2;
@ContextMenu( "Scale Existing Trees" )
// check if there is no terrain in the inspector, then use the current active terrain
if ( !terrain )
terrain = Terrain.activeTerrain;
// check if maxScale is less than minScale
if ( maxScale < minScale )
maxScale = minScale;
// variable for storing random calculated scale
var rndScale : float;
// store reference of all the current trees
var treeInstances : TreeInstance = terrain.terrainData.treeInstances;
// cycle through each tree
for ( var t : int = 0; t < treeInstances.length; t ++ )
// calculate random scale
rndScale = Random.Range( minScale, maxScale );
// apply to curent tree in array
treeInstances[t].heightScale = rndScale;
treeInstances[t].widthScale = rndScale;
// apply treeInstances back to terrain data
terrain.terrainData.treeInstances = treeInstances;
Debug.Log( "Scaling Trees Complete" );
if your tree is procedural, and you don’t wan’t to deal with scripting, check this out.