After adding prototypes to a terrain in runtime (procedurally generated content), I get this error:
Any idea what’s going on?
After adding prototypes to a terrain in runtime (procedurally generated content), I get this error:
Any idea what’s going on?
Ok I made a workaround by pre-adding all the potential trees to the terrain tree list, and then finding the index in runtime.
However, now I’m getting funky Editor closings, that kinda look like stack overflows (common that stack overflow causes silent application closure due to error-handling code causing subsequent stack overflows or whatnot):
NullReferenceException: Object reference not set to an instance of an object
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
… maybe 1000 more of these …
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEngineInternal.TreeBinaryTreeBuilder.Split (UnityEngineInternal.TreeBinaryTree bintree, .Prototype[ ] prototypes, Vector3 position, Vector3 scale, Int32 minimumInstances) [0x00181] (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Runtime\Export\Terrain\TreeRenderer.cs:915)
UnityEditor.EditorGUIUtility:RenderGameViewCameras(Rect, Rect, Boolean, Boolean)
UnityEditor.EditorGUIUtility:RenderGameViewCameras(Rect, Rect, Boolean, Boolean)
UnityEditor.GameView:OnGUI() (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Editor\Mono\GameView\GameView.cs:192)
System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ])
System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ])
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[ ], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[ ])
UnityEditor.HostView:Invoke(String) (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Editor\Mono\GUI\DockArea.cs:156)
UnityEditor.MaximizedHostView:OnGUI() (at C:\builds\unity-branches-2.5.x\unity-2.5.x\Editor\Mono\GUI\DockArea.cs:872)
(Filename: C:/builds/unity-branches-2.5.x/unity-2.5.x/Runtime/Export/Terrain/TreeRenderer.cs Line: 915)
Looks a bit weird to me, like a recursion bug.
I must say, the Terrain and TerrainData interface seems very shaky and obscure. Very little documentation, several undocumented interfacing points… and crash-prone once you start interfacing with it.
Furthermore, I’d like to point out that changes made to a TerrainData object during runtime, sticks to the object permanently, even though it’s not an Editor class or something.
It’s a bit weird IMO.