Search Unity

Bug Editor hang selecting GI object from large amount of procedurally placed objects

Discussion in 'Editor & General Support' started by ga5p0d3, Apr 24, 2020.

  1. ga5p0d3

    ga5p0d3

    Joined:
    Sep 27, 2017
    Posts:
    5
    I have encountered a serious editor stall/hang with the following scenario:
    • Using Unity 2019.3.3f1 or 2019.3.10f1 with HDRP
    • A scene with many hundreds of objects, for example this building upload_2020-4-24_10-16-38.png
    • Each has it's HideFlags set to DoNotSave (they are procedurally placed at runtime)
    • A large proportion of them are set to Contribute Global Illumination (default for the asset pack) upload_2020-4-24_10-16-18.png
    • Scene lighting has EITHER: Realtime GI, or, Baked Global Illumination, set to ON upload_2020-4-24_10-31-33.png
    Selecting one of the GI contributing objects in the scene causes a one second pause which is regularly repeated as the editor UI is navigated.
    upload_2020-4-24_10-32-46.png

    For larger scenes (e.g. 4x the quantity above) the hang becomes effectively infinite and requires killing of Unity in Task Manager.

    Unchecking BOTH Lighting options stops the above hitching for all the meshes.
    Unchecking the GI Contribution setting on a mesh stops the above hitching when selecting that mesh.

    Profiling the sessions has shown up reference to GI whilst redrawing the inspector window (see red in window above).
    Debugging the hung sessions shows up some warning message being displayed (although I've not seen the warning in the inspector).
    Code (CSharp):
    1. >    Void UnityEditor.LightingSettingsInspector:DisplayMeshWarning ()+0xb5 at :-1    C#
    2.      Void UnityEditor.LightingSettingsInspector:RenderSettings (Boolean, Boolean)+0x3ea at :-1    C#
    3.      Void UnityEditor.RendererEditorBase:LightingSettingsGUI (Boolean, Boolean)+0x9 at :-1    C#
    4.      Void UnityEditor.MeshRendererEditor:OnInspectorGUI ()+0xf7 at :-1    C#
    5.      Void <>c__DisplayClass55_0:<CreateIMGUIInspectorFromEditor>b__0 ()+0x274 at :-1    C#
    6.      Void UnityEngine.UIElements.IMGUIContainer:DoOnGUI (Event, Matrix4x4, Rect, Boolean, Rect, Boolean)+0x1a6 at :-1    C#
    7.      Boolean UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (Event, Matrix4x4, Rect, Boolean)+0x76 at :-1    C#
    8.      Void UnityEngine.UIElements.IMGUIContainer:DoIMGUIRepaint ()+0x54 at :-1    C#
    9.      Void UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh (DrawParams, Boolean, Single, Exception)+0x83 at :-1    C#
    10.      Void UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain (RenderChainCommand, Rect, Matrix4x4, PanelClearFlags, Texture, Texture, Texture, Single, NativeArray`1, NativeArray`1, Exception)+0x500 at :-1    C#
    11.      Void UnityEngine.UIElements.UIR.UIRenderDevice:DrawChain (RenderChainCommand, Rect, Matrix4x4, PanelClearFlags, Texture, Texture, Texture, Single, NativeArray`1, NativeArray`1, Exception)+0x2c at :-1    C#
    12.      Void UnityEngine.UIElements.UIR.RenderChain:Render (Rect, Matrix4x4, PanelClearFlags)+0x66e at :-1    C#
    13.      Void UnityEngine.UIElements.UIRRepaintUpdater:DrawChain (Rect, Matrix4x4)+0x20 at :-1    C#
    14.      Void UnityEngine.UIElements.UIRRepaintUpdater:Update ()+0x33 at :-1    C#
    15.      Void UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTreePhase (VisualTreeUpdatePhase)+0x1f at :-1    C#
    16.      Void UnityEngine.UIElements.Panel:UpdateForRepaint ()+0x3c at :-1    C#
    17.      Void UnityEngine.UIElements.Panel:Repaint (Event)+0x61 at :-1    C#
    18.      Boolean UnityEngine.UIElements.UIElementsUtility:DoDispatch (BaseVisualElementPanel)+0x29 at :-1    C#
    19.      Boolean UnityEngine.UIElements.UIElementsUtility:ProcessEvent (Int32, IntPtr)+0x3e at :-1    C#
    20.      Boolean UnityEngine.GUIUtility:ProcessEvent (Int32, IntPtr)+0x14 at :-1    C#
    And I've even seen reference to this specific error message string, which would make sense in context of the above information (and led me to try the GI flags).

    Some MeshRenderers cannot contribute to global illumination, because their HideFlags are set to DontSaveInEditor, HideAndDontSave or DontSaveInBuild.


    This is not specifically a problem for our team, as we won't be using Baked GI (proc-gen used extensively) although we may want to explore Runtime GI at a later date.

    This is a serious hang that can affect editor scenes relying heavily on procedural generation and as such potentially problematic for a small portion of the Unity dev demographic.

    Thanks,
    Sam
     
    Last edited: Apr 24, 2020
    Clay_More likes this.
  2. lazylukey

    lazylukey

    Joined:
    May 26, 2017
    Posts:
    36
    Experiencing the same issue on Unity 2019.4.13f1.

    We only experience this with 1 of our 3 complex scenes. What we have found is, if you disable the majority/all of the meshes in the scene (e.g. the entire environment) then enter Play mode and enable all of them again, you are then able to select a contribute GI mesh renderer without it locking up.

    @ga5p0d3 What exactly do you mean by procedurally placed? Are you constructing things like the building from your screenshot entirely from prefabs and code? In our scene while we do instantiate in a few prefabbed mesh renderers the majority of the scene is static meshes that are already in the scene.

    Edit: Solved it in our case in the end, we had instantiated a prefab that contained mesh renderers that has Contribute GI enabled. This caused the repeated freezing for us.
     
    Last edited: Jun 23, 2021
  3. KarelA

    KarelA

    Joined:
    Dec 30, 2008
    Posts:
    422
    Thank you for posting this. Many years have passed but i have exact same issue in 2023.3.4f1

    At least now i can continue my work
     
    salex1 likes this.