- Home /
This question was
closed Aug 29, 2015 at 12:53 AM by
getyour411 for the following reason:
Other
Can't delete trees through script
I'm getting this error when I try to run this code
MissingMethodException: UnityEngine.TreeInstance[].RemoveAt Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
for (i = 0; i < terrain.treeInstances.length; i++)
{
terrain.treeInstances.RemoveAt(i);
}
Comment
I'm not 100% how it works but I found some code that deletes all the trees
treeList = new List.<TreeInstance>();
Terrain.activeTerrain.terrainData.treeInstances = treeList.ToArray();