Search Issue Tracker
Fixed in 13.1.2
Votes
0
Found in [Package]
12.0.0
Issue ID
1371353
Regression
Yes
[HDRP] Debugger windows throws exception on every undo after domain reload if window was open but not in front during reload
The HDRP debugger window starts throwing exceptions on every undo after any domain reload that happens while the debugger window is open but not in front. Not uncommonly this leads to inconsistent state in the project, either breaking HDRP rendering itself, or some other random tool relying on Undo. It would be great if we could get this fixed. (details in thread)
I had a quick look in the code (2021.2/staging from ~5 days ago) and it looks like there's a couple of inconsistencies between the logic in editor window, assumptions about serialization and HDRP init for this case of enabled but hidden debugger window.
The first thing that happens after a domain reload is that DebugWindow's m_WidgetStates is restored from its flattened serialized form. At this point, any state of type DebugStateFlags has lost its boxed enum value because it's not a type Unity knows how to serializable. This widget state null value, in turn, is what breaks the state hash computation in OnUndoRedoPerformed throwing a NullReferenceException when trying to get its hash code.
A bit later, DebugWindow.OnEnable runs. Among other things it reads DebugManager.instance.panels in several locations to see if various state needs refreshing, however this collection is always empty because the SRP has not yet been instantiated. (This probably makes sense for the case of opening the window when you already have HDRP running, but for the domain reload case it seems to skip a lot of stuff)
Later on, when panels _are_ added in HDRP DebugWindow.MarkDirty is called and refreshEditorRequested is set. However, these dirty bits are only acted upon in DebugWindow.Update - which only runs for windows that are in front. Since we did register the OnUndoRedoPerformed callback in DebugWindow.OnEnable, though, it will happily do its thing anyway, running on incomplete state and failing on this now missing enum value.
(It's hard to know exactly which breakages this is responsible for and not.. I have a feeling there's a second undo related bug that's responsible for a fairly frequently occurring bug that breaks volumetric lighting in scene view, but getting this one fixed would allow for digging deeper)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Compiled Shader code has self-assignments and redundant code in the Shaders that use "enable_d3d11_debug_symbols"
- The script is not renamed in the Project window when renaming and a compilation Error is present
- Average FPS in Play Mode degradation on a newly created BiRP project when it's upgraded from 2020.3.48f1 to a newer Editor version
- DecoratorDrawer indentation is incorrect when it is called with EditorGUI
- "Unable to get the list of approved APIs." is thrown when testing the App Packages with Windows App Certification Kit
Resolution Note (fix version 13.1.2):
Fixed in: High Definition RP 13.1.2 (2022.1.0a1)