Search Unity

Is it possible to mass place trees from a script?

Discussion in 'Scripting' started by toreau, May 7, 2015.

  1. toreau

    toreau

    Joined:
    Feb 8, 2014
    Posts:
    204
    I'm aware that it's possible to mass place individual trees from a script, which is basically what I'm doing that the moment. What I want, however, is to mass place the trees the way the Unity editor is doing it via the terrain's "place trees" functionality.

    I want to do this so that I don't end up with thousands of individual game objects. I've googled quite a bit, but the few interesting results I've seen indicates that this is impossible - or at least extremely hard...?

    Thanks in advance!
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    It's pretty easy. Just use TerrainData.treeInstances