- Home /
Adding trees dynamically
Is it possible to add trees to the terrain by scripting?
Comment
Best Answer
Answer by Mike 3 · Jul 01, 2010 at 03:21 AM
You can indeed, but it's through the highly undocumented and unsupported TerrainData class
You'll want to play around with terrain.terrainData and inside that, treeInstances.
treeInstances is an array of TreeInstance objects, each of which you can set position on
Your best bet is most likely to just start out by cloning a TreeInstance, and changing the position (TreeInstance is a struct, so you can easily clone by assigning another TreeInstance to a new variable)
This is an older question but I've been looking into this for the past week with little luck. Can anyone give more details and possible example script? Thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220613063555im_/https://answers.unity.com/themes/thub/images/avi.jpg)