Unity Issue Tracker - Adding UxmlObjectReference to incompatible type causes compilation errors from source generator
Fixed
UUM-48264
Adding UxmlObjectReference to incompatible type causes compilation errors from source generator
Unity: UI Toolkit Controls
Fixed
2023.3.X
Adding the [UxmlObjectReference] attribute to a field that has a type that is not UxmlObject causes errors. We should improve this error message to explain that it is an incompatible type.
E.G
//[UxmlObject] // uncomment to fix
publicclass MyObject
{
[UxmlAttribute]
publicfloat myFloat;
}
[UxmlElement]
public partial class MyElement : VisualElement
{
[UxmlObjectReference("my-object")]
public MyObject myObj;
}
Prioritise and Follow this issue
Have a workaround or additional info about this issue?