Search Issue Tracker

Fixed in 2021.1.X

Votes

0

Found in

2019.4.0f1

2020.1

2020.2

2021.1

2021.1.0a10

Issue ID

1298490

Regression

No

[UI Builder] NullReferenceException error is thrown on saving .uxml file after applying changes in .uss file importer settings

UI Builder

-

.uxml file does not create after disabling Validation in .uss file Importer settings
Workaround: Project Winodw > Right-click > Refresh. (.uxml file will appear)

Steps to repro:
1. Create a new Project.
2. Window > UI Toolkit > UI Builder.
3. StyleSheets > Click on "+" > Create new USS > Test1.
4. Project Window > Select Test1 > Enable "Disable Validation" checkbox > Apply > Save.
5. In Save UXML window > File name > Test2 > Save.

Actual Result:
-NullReferenceException errors in the console.
-Test2 asset is not showing in the Project window.

Expected Result:
Test2.uxml asset file appears in the Project window without any errors in the console.

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

Environment:
Occurring on Windows 10 & Mac 10.15.

Stack trace:
NullReferenceException: Object reference not set to an instance of an object
Unity.UI.Builder.VisualTreeAssetExtensions.DeepOverwrite (UnityEngine.UIElements.VisualTreeAsset vta, UnityEngine.UIElements.VisualTreeAsset other) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderDocumentOpenUXML.PostSaveToDiskChecksAndFixes (System.String newUxmlPath, System.Boolean needsFullRefresh) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderDocumentOpenUXML.SaveNewDocument (UnityEngine.UIElements.VisualElement documentRootElement, System.Boolean isSaveAs, System.Boolean& needsFullRefresh, System.String manualUxmlPath) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderDocumentOpenUXML.SaveUnsavedChanges (System.String manualUxmlPath, System.Boolean isSaveAs) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderDocumentOpenUXML.CheckForUnsavedChanges (System.Boolean assetModifiedExternally) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderDocument.CheckForUnsavedChanges (System.Boolean assetModifiedExternally) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderToolbar.LoadDocument (UnityEngine.UIElements.VisualTreeAsset visualTreeAsset, System.Boolean unloadAllSubdocuments, System.Boolean assetModifiedExternally) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderDocumentOpenUXML.OnPostProcessAsset (System.String assetPath) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderDocument.OnPostProcessAsset (System.String assetPath) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
Unity.UI.Builder.BuilderAssetPostprocessor.OnPostprocessAllAssets (System.String[] importedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at <185bda1d3c3049d3b8a4852e0de3edf6>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
UnityEditor.AssetPostprocessingInternal.InvokeMethod (System.Reflection.MethodInfo method, System.Object[] args) (at <a19e86c7bf354115a4c6a5953c0575cb>:0)
UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at <a19e86c7bf354115a4c6a5953c0575cb>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

  1. Resolution Note (fix version 2021.1):

    Fixed in 2021.2.0a9.1376

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.