Search Issue Tracker

Fixed

Fixed in 2022.3.58f1, 6000.0.38f1, 6000.1.0b6, 6000.2.0a2, 7000.0.0a17

Votes

0

Found in

2021.3.40f1

2022.3.40f1

6000.0.13f1

6000.1.0a7

6000.2.0a1

7000.0.0a1

Issue ID

UUM-76821

Regression

No

NullReferenceException is thrown when undoing Selector deletion in Isolation

-

Steps to reproduce:

  1. Create or open any Project with the UI Toolkit installed
  2. Create a "UI Document" Asset and open it
  3. Add any UI Element to the Hierarchy
  4. Right click it and select "Create Template" and select it
  5. Create and attach a StyleSheet with a Selector added to it
  6. Right click the Template in the Hierarchy and select "Open Instance in Isolation"
  7. In the StyleSheets section, select a greyed out Selector, right click to delete it
  8. Undo

Actual results: "NullReferenceException: Object reference not set to an instance of an object" is thrown

Expected results: No Errors are thrown

Reproducible with versions: 2021.3.40f1, 2022.3.40f1, 6000.0.13f1

Tested on (OS): macOS Sonoma, Windows 11

Error message:
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.StyleSheets.ConverterUtils.FindProperty (UnityEngine.UIElements.StyleComplexSelector selector, System.String propertyName) (at <284b2bcf4ed84f27916114fd162acc12>:0)
Unity.UI.Builder.StyleComplexSelectorExtensions.IsSelected (UnityEngine.UIElements.StyleComplexSelector scs) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.VisualElementExtensions.IsSelected (UnityEngine.UIElements.VisualElement element) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.VisualElementExtensions.FindSelectedElementsRecursive (UnityEngine.UIElements.VisualElement parent, System.Collections.Generic.List`1[T] selected) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.VisualElementExtensions.FindSelectedElementsRecursive (UnityEngine.UIElements.VisualElement parent, System.Collections.Generic.List`1[T] selected) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.VisualElementExtensions.FindSelectedElementsRecursive (UnityEngine.UIElements.VisualElement parent, System.Collections.Generic.List`1[T] selected) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.VisualElementExtensions.FindSelectedElementsRecursive (UnityEngine.UIElements.VisualElement parent, System.Collections.Generic.List`1[T] selected) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.VisualElementExtensions.FindSelectedElements (UnityEngine.UIElements.VisualElement element) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.BuilderSelection.RestoreSelectionFromDocument (UnityEngine.UIElements.VisualElement sharedStylesAndDocumentElement) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.Builder.OnEnableAfterAllSerialization () (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.Builder.OnUndoRedo () (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
Unity.UI.Builder.BuilderCommandHandler.OnUndoRedo (UnityEditor.UndoRedoInfo& info) (at <dfb6f584aa494374b9127edd7bcf5d6d>:0)
UnityEditor.Undo.Internal_CallUndoRedoEvent (UnityEditor.UndoRedoInfo undoInfo) (at <284b2bcf4ed84f27916114fd162acc12>:0)
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
**

Add comment

Log in to post comment