Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Crashing on versions after 2020.1.9f1 on setting trees

Discussion in 'Editor & General Support' started by andrew210, Nov 16, 2020.

  1. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    195
    Hello, this bit of code worked fine up until 2020.1.10f1 for setting tree instances on a terrain:


    Code (CSharp):
    1.  
    2.     internal void loadTrees(BinaryReader aReader, Terrain aTerrain)
    3.     {
    4.         List<TreeInstance> trees =readTrees(aReader);
    5.         aTerrain.terrainData.treeInstances = trees.ToArray();
    6.     }
    7.  
    However on all versions so far released after 2020.1.9f1 this causes a crash with a log:

    Code (CSharp):
    1.  
    2. ========== OUTPUTTING STACK TRACE ==================
    3.  
    4. 0x00007FF71575A10A (Unity) TreeRenderer::WillRenderTrees
    5. 0x00007FF71571FC78 (Unity) TerrainManager::AfterCullingOutputReady
    6. 0x00007FF71461C800 (Unity) CullSendEvents
    7. 0x00007FF71461C710 (Unity) CullScene
    8. 0x00007FF7145EE287 (Unity) Camera::CustomCull
    9. 0x00007FF7145FCC4B (Unity) RenderManager::RenderCameras
    10. 0x00007FF715CCB439 (Unity) RepaintController::RenderPlayModeViewCameras
    11. 0x00007FF7164F765E (Unity) EditorGUIUtility::RenderPlayModeViewCamerasInternal
    12. 0x00007FF716C51212 (Unity) EditorGUIUtility_CUSTOM_RenderPlayModeViewCamerasInternal_Injected
    13. 0x000001F96317A747 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorGUIUtility:RenderPlayModeViewCamerasInternal_Injected (UnityEngine.RenderTexture,int,UnityEngine.Vector2&,bool,bool)
    14. 0x000001F96317A5D3 (Mono JIT Code) UnityEditor.EditorGUIUtility:RenderPlayModeViewCamerasInternal (UnityEngine.RenderTexture,int,UnityEngine.Vector2,bool,bool)
    15. 0x000001F963174AA3 (Mono JIT Code) UnityEditor.PlayModeView:RenderView (UnityEngine.Vector2,bool)
    16. 0x000001F95E214A23 (Mono JIT Code) UnityEditor.GameView:OnGUI ()
    17. 0x000001F95E20D834 (Mono JIT Code) UnityEditor.HostView:InvokeOnGUI (UnityEngine.Rect,UnityEngine.Rect)
    18. 0x000001F95E20D1C3 (Mono JIT Code) UnityEditor.DockArea:DrawView (UnityEngine.Rect,UnityEngine.Rect)
    19. 0x000001F95E1F15B3 (Mono JIT Code) UnityEditor.DockArea:OldOnGUI ()
    20. 0x000001F95E1BA47A (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect,System.Action,bool)
    21. 0x000001F95E1B7D43 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,System.Action,bool)
    22. 0x000001F96314A633 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoIMGUIRepaint ()
    23. 0x000001F963145FF6 (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams,single,System.Exception&)
    24. 0x000001F96314224B (Mono JIT Code) UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain (UnityEngine.UIElements.UIR.RenderChainCommand,UnityEngine.Material,UnityEngine.Material,UnityEngine.Texture,UnityEngine.Texture,UnityEngine.Texture,single,Unity.Collections.NativeSlice`1<UnityEngine.UIElements.UIR.Transform3x4>,Unity.Collections.NativeSlice`1<UnityEngine.Vector4>,UnityEngine.MaterialPropertyBlock,bool,System.Exception&)
    25. 0x000001F96313677B (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChain:Render ()
    26. 0x000001FA1F77800B (Mono JIT Code) UnityEngine.UIElements.UIRRepaintUpdater:Update ()
    27. 0x000001F95E08F06A (Mono JIT Code) UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase)
    28. 0x000001FA1F776793 (Mono JIT Code) UnityEngine.UIElements.Panel:UpdateForRepaint ()
    29. 0x000001FA1F775B33 (Mono JIT Code) UnityEngine.UIElements.Panel:Repaint (UnityEngine.Event)
    30. 0x000001F95E08DC81 (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
    31. 0x000001F95E08D5E3 (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&)
    32. 0x000001F95E08CF4F (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration:ProcessEvent (int,intptr)
    33. 0x000001F95E08CC3B (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration/<>c:<.cctor>b__1_2 (int,intptr)
    34. 0x000001F95E08C735 (Mono JIT Code) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    35. 0x000001F95E08C956 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_int_intptr_intptr& (object,intptr,intptr,intptr)
    36. 0x00007FF903ECDB10 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
    37. 0x00007FF903E52902 (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2921] do_runtime_invoke
    38. 0x00007FF903E5B95F (mono-2.0-bdwgc) [c:\build\output\unity-technologies\mono\mono\metadata\object.c:2968] mono_runtime_invoke
    39. 0x00007FF7152759E4 (Unity) scripting_method_invoke
    40. 0x00007FF71526F50B (Unity) ScriptingInvocation::Invoke
    41. 0x00007FF7152691E5 (Unity) ScriptingInvocation::Invoke<void>
    42. 0x00007FF713B2F72D (Unity) Scripting::UnityEngine::GUIUtilityProxy::ProcessEvent
    43. 0x00007FF715DAB488 (Unity) GUIView::ProcessRetainedMode
    44. 0x00007FF716685E9D (Unity) GUIView::OnInputEvent
    45. 0x00007FF715DAB3B1 (Unity) GUIView::ProcessInputEventInternal
    46. 0x00007FF71667C669 (Unity) GUIView::DoPaint
    47. 0x00007FF7166883DD (Unity) GUIView::RepaintAll
    48. 0x00007FF715E770A8 (Unity) PlayerLoopController::UpdateScene
    49. 0x00007FF715E760A0 (Unity) Application::TickTimer
    50. 0x00007FF7166851C4 (Unity) MainMessageLoop
    51. 0x00007FF71668E55E (Unity) WinMain
    52. 0x00007FF718364536 (Unity) __scrt_common_main_seh
    53. 0x00007FF97A8A7034 (KERNEL32) BaseThreadInitThunk
    54. 0x00007FF97BF1CEC1 (ntdll) RtlUserThreadStart
    55.  
    56. ========== END OF STACKTRACE ===========

    Is there anything I can do to fix this issue.
     
  2. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    296
    We're having the same issue. Seems to have started with Unity 2020. And I'm seeing it at exactly at the same point as you are, when terrain tree instances are being reset through code at runtime.

    Interestingly, it works fine if my terrain tree instances are reset during OnApplicationQuit(). It only crashes if I try to reset the tree instances during the regular "runtime" events, such as during Update(), OnActiveSceneChanged(), etc. So there's something different about resetting the terrain tree instances during OnApplicationQuit(), because that's the only time it works for me.
     
  3. niallmc

    niallmc

    Joined:
    Sep 3, 2015
    Posts:
    42
    Same issue here, Unity 2020.2.7.

    Happening for me when tree instances are set in the editor, outside of playmode. Anyone get an answer on this?
     
unityunity