Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question ListView bindItem and makeItem getting set to default

Discussion in 'UI Toolkit' started by Joey35233, Feb 13, 2023.

  1. Joey35233

    Joey35233

    Joined:
    Dec 30, 2017
    Posts:
    6
    Between 2022.2.2f1 and 2022.2.3f1, something has changed with ListViews. I have multiple using custom makeItem and bindItem pairs. Debugging shows that when the Inspector is loading, makeItem and bindItem get called correctly but then the controls get wiped and then the default versions of bindItem and makeItem (makeItem just makes a PropertyField, bindItem just binds to it) run and that second pass is what actually shows up in the editor. I did a bit of investigating and it happens because
    ListViewSerializedObjectBinding.ClearListView
    , called only by
    ListViewSerializedObjectBinding.Release
    , now resets makeItem and bindItem to null.

    I'm rather confused. I'm not sure why the backend code would reset user settings like that but more importantly, I don't understand why my ListView binding is being released and completely regenerated before the editor loads. Could it be that I'm making a binding mistake that happened to put me in a code path with a new bug? Or maybe the real bug is that it's regenerating the binding when it shouldn't?
     
  2. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    370
    Hi @Joey35233!

    If you have set the
    makeItem
    and
    binditem 
    and they are being overwritten by the system, it is a bug, can you report it using "Help > Report a Bug..."?

    Thank you!
     
  3. gentlymadstudios

    gentlymadstudios

    Joined:
    Jun 13, 2019
    Posts:
    8
    Hi @Joey35233,

    I had a very similar problem until I found out I had manually called .Bind in my CreateInspectorGUI method, which already also calls Bind internally AFAIK. Removing my manual Bind solved the problem in my case. Maybe this helps!