Hello. I haven’t found any working example of how to do this:
There is a certain classes:
public enum Langs
{
EN,
ARA
}
[Serializable]
public class LocalTextDirectionType
{
public Langs Lang
}
public class SomeClass {
public List<LocalTextDirectionType> someProperty;
}
There is a custom inspector, in which there is the ListView
[CustomEditor(typeof(SomeClass)), CanEditMultipleObjects]
public class Some: Editor
{
public override VisualElement CreateInspectorGUI()
{
VisualElement rootInspector = new VisualElement();
_list = new ListView()
{
virtualizationMethod = CollectionVirtualizationMethod.DynamicHeight,
showFoldoutHeader = true,
headerTitle = "Localized",
showAddRemoveFooter = true,
reorderMode = ListViewReorderMode.Animated,
makeItem = () => CreateAlignmentRow(),
bindItem = (element, i) =>
{
},
bindingPath = "someProperty",
};
rootInspector.Bind(serializedObject)
rootInspector .Add(_list)
}
}
And I get an error:
ArgumentException: Can't find array size property!
UnityEditor.UIElements.Bindings.SerializedObjectList.RefreshProperties () (at <d66e1a49bb1b4f56b6bbb21deaafcac2>:0)
UnityEditor.UIElements.Bindings.SerializedObjectList..ctor (UnityEditor.SerializedProperty parentProperty) (at <d66e1a49bb1b4f56b6bbb21deaafcac2>:0)
UnityEditor.UIElements.Bindings.ListViewSerializedObjectBinding.SetBinding (UnityEngine.UIElements.ListView targetList, UnityEditor.UIElements.Bindings.SerializedObjectBindingContext context, UnityEditor.SerializedProperty prop) (at <d66e1a49bb1b4f56b6bbb21deaafcac2>:0)
UnityEditor.UIElements.Bindings.ListViewSerializedObjectBinding.CreateBind (UnityEngine.UIElements.ListView listView,
I try:
bindingPath = "someProperty.Array"
, but this also doesn’t work correctly
Please help me Bind serializedObject with ListView