A simple low poly procedural tree builder.
- Safe threading support for fast creation.
- Scriptable Object support for saving Tree Data. (Create > Procedural Generation > Tree Data)
- Infinite possibilities of trees.
- 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);
}
- Add a pooling system.
- Create vegetation system. (e.g. flowers, plants)
- Project is based of https://github.com/mattatz/unity-procedural-tree
- Procedural Sphere creation and shaders https://github.com/Syomus/ProceduralToolkit
- Video that helped with threading: https://www.youtube.com/watch?v=f0m73RsBik4
MIT