- Home /
Tree Instance Static Batching
Hey folks, I can't find a workaround for this problem so far. I'm "instantiating" a lot of trees from tree prefabs by using the tree instance class:
var TreeList = new ArrayList();
for(int i = 0; i < treecount;i++) {
tree.position = treePos;
TreeList.Add(tree);
}
terrainData.treeInstances = (TreeInstance[])TreeList.ToArray(typeof(TreeInstance));
Works fine so far. But now I want to access the tree instances as game objects to be able to combine them using the StaticBatchingUtility. Unfortunately
StaticBatchingUtility.Combine(GameObject[] gos, GameObject staticBatchRoot);
only accepts arrays of game objects. Is there any possibility to get the belonging game object of the tree instance? Marking my tree prefabs as static doesn't help. The draw calls are still at 1500.
Your answer
![](https://koobas.hobune.stream/wayback/20220612164956im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Instantiate trees on terrain with perfect height. 2 Answers
Terrain Tree Billboard have bright outline against dark background 6 Answers
Terrain system trees slightly sharpen and blur depending on camera rotation 2 Answers
Terrain trees aren't solid,Terrain Trees 0 Answers
Why does my tree script not work 2 Answers