I have a custom control with two properties, for example:
[UxmlElement("TestCustomControl")]
public partial class TestCustomControl : VisualElement
{
[UxmlAttribute]
public string MyString { get; set; } = MYSTRING_DEFAULT_VALUE;
[UxmlAttribute]
public int MyInt { get; set; } = MYINT_DEFAULT_VALUE;
// etc ...
At this point the attributes can be edited via UIBuilder Inspector, for example:
However, if I set their values programmatically, for example:
private void SetConfiguration1()
{
Debug.Log("Setting configuration 1");
MyString = "Config1 string";
MyInt = 1;
}
The attributes can no longer be edited via UIBuilder Inspector and their values are stuck to the values set programmatically, for example:
So, my question is: How can I leave a custom control UXMLAttribute editable via UIBuilder Inspector even if I set its value programmatically?