Search Issue Tracker

Fix In Review for 2021.2.X

Votes

0

Found in

2019.4.0f1

2020.1

2020.2

2021.1

2021.1.0a10

Issue ID

1300096

Regression

No

[UI Builder] MissingReferenceException errors thrown on creating any elements after deleting USS file from the project window

UI Builder

-

MissingReferenceException errors are thrown on creating any elements after deleting USS file from the project window.

Steps to repro:
1. Create a new Project.
2. Window > UI Toolkit > UI Builder.
3. StyleSheets > Click on "+" > Create New USS > "Test".
4. Project Window > Delete "Test" USS file.
5. UI Builder > Library > Double click on the label.

Actual Result:
MissingReferenceException errors in the console.

Expected Result:
No errors in the console.

Reproducible in:
2021.1.0a10, 2020.2.0f1, 2020.1.1f1, 2019.4.0f1 with Package version 1.0.0-preview.9.

Environment:
Occurring on Windows 10 & Mac 10.15.

Stack trace:
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 <cb77d76f0e674d3da5f8c94addc0e0a6>:0)
UnityEditor.UIElements.Debugger.MatchedRulesExtractor.FindStyleSheets (UnityEngine.UIElements.VisualElement cursor, UnityEngine.UIElements.StyleMatchingContext matchingContext) (at <7ba5bac7360d4ac8a9ebd5b4256fdfe2>:0)
UnityEditor.UIElements.Debugger.MatchedRulesExtractor.FindStyleSheets (UnityEngine.UIElements.VisualElement cursor, UnityEngine.UIElements.StyleMatchingContext matchingContext) (at <7ba5bac7360d4ac8a9ebd5b4256fdfe2>:0)
UnityEditor.UIElements.Debugger.MatchedRulesExtractor.FindMatchingRules (UnityEngine.UIElements.VisualElement target) (at <7ba5bac7360d4ac8a9ebd5b4256fdfe2>:0)
Unity.UI.Builder.BuilderInspectorMatchingSelectors.GetElementMatchers () (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderInspector.RefreshUI () (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderInspector.SelectionChanged () (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderSelection.NotifyOfSelectionChange (Unity.UI.Builder.IBuilderSelectionNotifier source) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderSelection.Select (Unity.UI.Builder.IBuilderSelectionNotifier source, UnityEngine.UIElements.VisualElement ve) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderLibraryView+<>c__DisplayClass13_0.<AddItemToTheDocument>b__2 () (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
UnityEngine.UIElements.VisualElement+SimpleScheduledItem.PerformTimerUpdate (UnityEngine.UIElements.TimerState state) (at <b82edc26c1654793bdaefb66b6a2a38a>:0)
UnityEngine.UIElements.TimerEventScheduler.UpdateScheduledEvents () (at <b82edc26c1654793bdaefb66b6a2a38a>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.UpdateSchedulers () (at <b82edc26c1654793bdaefb66b6a2a38a>:0)
UnityEngine.UIElements.UIEventRegistration.UpdateSchedulers () (at <b82edc26c1654793bdaefb66b6a2a38a>:0)
UnityEditor.RetainedMode.UpdateSchedulers () (at <7ba5bac7360d4ac8a9ebd5b4256fdfe2>:0)

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.