Search Issue Tracker
Fixed
Fixed in 2023.2.0a21
Votes
0
Found in
2023.2.0a18
Issue ID
UUM-40107
Regression
No
Generated `UxmlObject` and `UxmlElements` are not being detected by TypeCache when they contain an attribute with default values
When an element contains an attribute that has default values in its constructor it will no longer appear in the UI Builder or be serializable from UXML.
The issue can be seen in the Editor log file where an error occurs in the source generator.
1) Add the following script to a project:
{code:java}
using UnityEngine.UIElements;
[System.AttributeUsage(System.AttributeTargets.All)]
public class DisplayNameAttribute : System.Attribute
{
public string Name { get; set; }
public string IconPath { get; set; }
public DisplayNameAttribute(string name, string iconPath = null)
{
Name = name;
IconPath = iconPath;
}
}
[UxmlElement]
public partial class MyElement : VisualElement
{
[UxmlAttribute, DisplayName("my name")]
public float myField;
}
{code}
2) Notice the element does not appear in the UI Builder Library. The Editor log file will contain an error message, however it wont be visible in the console.
3) Remove DisplayName from myField.
4) Element is now visible.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Editor crashes and a window with "GetManagerFromContext: pointer to object of manager 'MonoManager' is NULL (table index 5)" error is shown when launching a freshly created project
- Editor Windows dragging behavior is erratic/glitchy when a specific multi-display setup is used and the Editor window is not on the main display
- Meta Quest missing an icon in Build Profiles window in U6.0
- Foldout arrow indent is misaligned in the Inspector when used for Arrays or Lists
- Material import pipeline strips properties when it is added with a script
Add comment