Skip to content

Latest commit

 

History

History
71 lines (46 loc) · 1.98 KB

File metadata and controls

71 lines (46 loc) · 1.98 KB

A simple low poly procedural tree builder.

10000 Trees10000 Trees

Features

  • Safe threading support for fast creation.
  • Scriptable Object support for saving Tree Data. (Create > Procedural Generation > Tree Data)

enter image description here

  • Infinite possibilities of trees.

Usage Example

  • Drop "TreeGenerationManager" Prefab into scene.
  • Create a MonoBehaviour script using namespcace "TreeGen".
  public int NumberOfTrees = 100;
  List<GameObject> trees;

  void Start()
  {
      trees = new List<GameObject>();

      for (int i = 0; i < Mathf.RoundToInt(NumberOfTrees / 2); i++)
      {
          for (int y = 0; y < Mathf.RoundToInt(NumberOfTrees / 2); y++)
          {
              TreeData data = ScriptableObject.CreateInstance<TreeData>();
              data.RandomiseParameters();
              TreeGeneratorManager.instance.RequestTree(data, new Vector3(i * 10, 0, y * 10), callback);
          }
      }
  }

  public void callback(GameObject g)
  {
      trees.Add(g);
  }

Todos

  • Add a pooling system.
  • Create vegetation system. (e.g. flowers, plants)

Resources Credits

License

MIT