Not signed in
Copyright © 2026 Unity Technologies
Fixed UUM-32501: UI Toolkit: Fixed selection in custom controls in UI Builder
Fixed UUM-32501: UI Toolkit: Fixed selection in custom controls in UI Builder
Fixed UUM-32501: UI Toolkit: Fixed selection in custom controls in UI Builder
Fixed UUM-32501: UI Toolkit: Fixed selection in custom controls in UI Builder
2022.2.X ports not supported anymore. See 2022.3.X port.
2022.1.X ports not supported anymore. See 2022.3.X port.
Fixed UUM-32501: UI Toolkit: Fixed selection in custom controls in UI Builder
Steps to repro:
1. Create a custom VisualElement named TestElement, that has a Label as a child element. Since I want to avoid building the visual tree in C#, my class contains the following:
#
using UnityEditor;
public TestElement()
{ # VisualTreeAsset uxml = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/Editor/UXML/TestElement.uxml"); # TemplateContainer root = uxml!.Instantiate(); # this.hierarchy.Add(root); # }
}
2. When selecting the Label element in the Hierarchy Panel of the UI Builder, you get a NullReferenceException and the Inspector Panel doesn't refresh all the Label infos correctly.
NullReferenceException: Object reference not set to an instance of an object
Unity.UI.Builder.BuilderInspectorAttributes.RefreshAttributeField (UnityEngine.UIElements.BindableElement fieldElement) (at <415ec9d438ed4f3badc4f75a27f3e7ff>:0)
Unity.UI.Builder.BuilderInspectorAttributes.CreateAttributeRow (UnityEngine.UIElements.UxmlAttributeDescription attribute) (at <415ec9d438ed4f3badc4f75a27f3e7ff>:0)
Unity.UI.Builder.BuilderInspectorAttributes.GenerateAttributeFields () (at <415ec9d438ed4f3badc4f75a27f3e7ff>:0)
Unity.UI.Builder.BuilderInspectorAttributes.Refresh () (at <415ec9d438ed4f3badc4f75a27f3e7ff>:0)
Unity.UI.Builder.BuilderInspector.RefreshUI () (at <415ec9d438ed4f3badc4f75a27f3e7ff>:0)
Unity.UI.Builder.BuilderInspector.SelectionChanged () (at <415ec9d438ed4f3badc4f75a27f3e7ff>:0)
The culprit seems to be:
internal void CloneTree(VisualElement target, Dictionary<string, VisualElement> slotInsertionPoints, List<TemplateAsset.AttributeOverride> attributeOverrides)
... gets called with the attributeOverrides set to null whenever Clone() or Instantiate() is called
Sign in to see your voted issues