Search Issue Tracker

Fixed in 2021.1.X

Votes

0

Found in

2019.3.0a12

Issue ID

1228706

Regression

No

Stylesheet can be garbage collected but still tried to be used in UIElement

HD RP

-

When the "Look Dev" window is opened and the High Definition RP package is upgraded from 7.1.8 to 7.2.0/7.2.1 , causes the editor to throw multiple exceptions continuously and "Look Dev" window turns to white, refer the attached video.

Steps to repro:
1. Create a new project with HDRP Template
2. Window > Render Pipeline > Look Dev
3. Keep "Look Dev" window opened
4. Be sure to not have collab as it can cause issue hidding this one
5. Upgrade HDRP package from 7.1.8 to 7.2.1

Actual Result:
Exceptions are thrown on upgrading HDRP package from 7.1.8 to 7.2.1 and everything go white in the window.

Expected Result:
Upgrading package doesn't affect anything to "Look Dev" window

Note: "Look Dev" window is introduced in Unity 2019.3.0a12. The bug can have existed prior this.

Reproducible in:
2020.1.0a24, 2019.3.2f1, 2019.3.0a12

Note: do not try this step to reproduce with 2020 beta as the 7.x.x package are not available anymore.

Environment:
Windows 10 and macOS 10.14

See former version of this bug here: https://fogbugz.unity3d.com/f/cases/1219692/ (include this issue and another one that will be fixed.)

CallStack:
MissingReferenceException: The object of type 'StyleSheet' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Object.get_name () (at <94c5f4c38cdc42d2b006f8badef04394>:0)
UnityEngine.UIElements.StyleSheets.StyleSheetCache.GetPropertyID (UnityEngine.UIElements.StyleSheet sheet, UnityEngine.UIElements.StyleRule rule, System.Int32 index) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.StyleSheets.StyleSheetCache.GetPropertyIDs (UnityEngine.UIElements.StyleSheet sheet, System.Int32 ruleIndex) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.StyleSheets.StylePropertyReader.SetContext (UnityEngine.UIElements.StyleSheet sheet, UnityEngine.UIElements.StyleComplexSelector selector, UnityEngine.UIElements.StyleVariableContext varContext, System.Single dpiScaling) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal.ProcessMatchedRules (UnityEngine.UIElements.VisualElement element, System.Collections.Generic.List`1[T] matchingSelectors) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.VisualTreeStyleUpdaterTraversal.TraverseRecursive (UnityEngine.UIElements.VisualElement element, System.Int32 depth) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.StyleSheets.HierarchyTraversal.Traverse (UnityEngine.UIElements.VisualElement element) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.VisualTreeStyleUpdater.ApplyStyles () (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.VisualTreeStyleUpdater.Update () (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <57fa7f4ad1c34ed185465e0a9f71c244>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <59837000ebf54955a9cb1d31caa86097>:0)

AdditionalInfo:
- The window class is in com.unity.render-pipelines.core\Editor\LookDev\DisplayWindow.cs
- The Stylesheet is loaded at the top of Window.OnEnable
- Removing the stylesheet loading from OnEnable and putting it in the first call of Window.OnGUI fix the crash but we then have a first frame with wrong layout each time we open the window.
- Having the loading of stylesheet in both OnEnable and first call of OnGUI could work if there is a filtering internal to stylesheet handling to remove garbage collected stylesheets.
- The other error spawned several time is fixed in the former ticket but the fix do not remove the broken window.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.