I’ve been banging my head against an issue for a couple of hours.
I have a custom editor with a list of objects that have nested lists inside of them and I’m using a list view with the built in add/remove footer buttons to manage them.
If I want to add an entry to the inner most list, it’s no big deal that the new value is a duplicate of the last one, I can just remove it.
If I want to add an entry to the outermost list however, it gets very tedious because of all the nested lists.
I’m using binding paths to automatically bind everything so I don’t have references to my lists. The listView.itemsAdded callback returns a IEnumerable with the indices of the added items, but the those indices are outside the range of the array at that point and I wouldn’t be able to just do listView.itemSource.Remove(index) anyway.
So my question is, how do I handle adding empty elements to a ListView from the +/- buttons?
Everywhere I look seem to just say I need to have a reference to my source list and just change the added value then refresh the list, but I can’t do that in this case.
I’ve tried extending ListView and ListViewController to override the add function. I’ve tried my own +/- buttons, I’ve tried passing references to serializedProperties all the way down to my deepest nested list, but I wasn’t able replace it’s value.